acsone / setuptools-odoo

A library to help packaging Odoo addons with setuptools. It mainly populates the usual setup.py keywords from the Odoo manifest files.
GNU Lesser General Public License v3.0
41 stars 46 forks source link

Static installation (no -e) loses data files #20

Closed simahawk closed 6 years ago

simahawk commented 7 years ago

19 showed that we can install addons statically (no editable mode + git clone).

The issue is that python installation works but odoo one no. Because...

# odoo -u foo
[...]
IOError: File not found: foo/security/ir.model.access.csv

This doc section says that some setuptools flags like include_package_data should be automatically handled but I don't see them in the auto-generated setup files. Also, AFAIR such flags rely on MANIFEST.in but there's no such file.

Shouldn't we include such files explicitly for every repo?

sbidoul commented 7 years ago

The setup keywords are injected here. This code triggers when the odoo_addon keyword is present in setup.py.

It is actually setuptools-git, which is a dependency of setuptools-odoo, that finds the package data by looking at all files in the packages that are under git control. So indeed installing from a tarball that is disconnected from git will not work unless you add a MANIFEST.in.

Note that installing from a proper source distribution tarball (built with python setup.py sdist) does work because that one includes the .egg-info metadata directory.

Also note that in the future, I would like to use setuptools-scm instead of setuptools-git because it is part of pypa and supports other vcses. But at this point it does not support symlinks.

sbidoul commented 7 years ago

What is your use case with tarballs, btw?

simahawk commented 7 years ago

I see. Well, my aim is to be able to get rid of git clone and skip the release step (package on pypi or alike) at the same time. For private repos this would help a lot. But I guess I'm desiring too much, isn't it? :sweat_smile:

sbidoul commented 7 years ago

To release we do, pip wheel -r requirements.txt -d wheel-dir. It gives you a bunch of wheels you can deploy without git (nor internet) access. Does that help in your scenario?

simahawk commented 7 years ago

well I guess we can do that on build time and include this folder in our docker image. Is that what you do? Then what? You make pip find those wheels there instead of fetching from pypi I guess. /cc @guewen

sbidoul commented 7 years ago

Exactly that, yes.

simahawk commented 7 years ago

I found a way here https://github.com/OCA/website-cms/pull/34 Maybe we can make a default (?)

sbidoul commented 7 years ago

I commented there.

About making the manifest a default, it's difficult to enumerate all files that could potentially be part of an odoo addon. It can be anything, potentially any data file.

I'm still not sure I understand in which scenarios you want to install from sources that are disconnected from git. Why do you want to skip the git clone? You mention private repos, but then getting the tarball from a private repo is not easier than a git clone.

sbidoul commented 7 years ago

We can do a call about that if you want to.

simahawk commented 7 years ago

Well, potentially ALL files. Or at least all the ones that are not ignored by .gitignore. But I've never seen files contained in odoo modules that should not be there... I'd use even a *.* to make sure we include everything :P

As for the scenario: would be great if we can make a call. Thanks! I'll poke you on either tomorrow or on Monday via IRC or hangout, ok?

sbidoul commented 7 years ago

Ok. Hangout preferably.

sbidoul commented 6 years ago

Installing from sources disconnected from git should be from a proper sdist. Also discussed in #24. So closing this one. Feel free to reopen if more discussion is needed.