PKG resources should find it anywhere in the python path. I'd the path correct within the all processes? On 1 Sep 2015 2:53 pm, "Ben Finney" <ben+deb...@benfinney.id.au> wrote:
> Howdy all, > > How can I specify to Pybuild that an application should have its modules > all in a private namespace, but have the Distutils metadata also > available to `pkg_resources` queries? > > I install its libraries to an application-specific space with > `PYBUILD_INSTALL_ARGS = --install-lib=/usr/share/foo/`:: > > $ find /usr/share/FooApp/ > /usr/share/FooApp/ > /usr/share/FooApp/lorem > /usr/share/FooApp/lorem/__init__.py > /usr/share/FooApp/lorem/dolor.py > /usr/share/FooApp/lorem/sit.py > /usr/share/FooApp/lorem/amet.py > /usr/share/FooApp/FooApp-1.2.3.egg-info > /usr/share/FooApp/FooApp-1.2.3.egg-info/PKG-INFO > /usr/share/FooApp/FooApp-1.2.3.egg-info/requires.txt > /usr/share/FooApp/FooApp-1.2.3.egg-info/entry_points.txt > /usr/share/FooApp/FooApp-1.2.3.egg-info/not-zip-safe > /usr/share/FooApp/FooApp-1.2.3.egg-info/dependency_links.txt > /usr/share/FooApp/FooApp-1.2.3.egg-info/top_level.txt > /usr/share/FooApp/ipsum > /usr/share/FooApp/ipsum/__init__.py > /usr/share/FooApp/ipsum/consecteur.py > /usr/share/FooApp/ipsum/adipiscing.py > /usr/share/FooApp/ipsum/elit.py > > (The actual code base is a fork of ‘dput’ to modernise its packaging > <URL:https://notabug.org/bignose/dput/> and Python idioms.) > > The application's Python package is managed like other operating system > files, but is not in the general Python namespace for other programs to > import. Good. > > The application has “console scripts” defined in the Distutils > `entry_points` mapping: > > $ cat ./setup.py > […] > entry_points={ > 'console_scripts': [ > "foo=FooApp.foo:main", > ], > }, > […] > > which installs command-line programs at `/usr/bin/foo`, for example. > Good. > > The distribution metadata (the `FooApp-1.2.3.egg-info` directory) is > also installed to the private directory though, which makes it invisible > to `pkg_resources`: > > $ /usr/bin/foo > Traceback (most recent call last): > File "/usr/bin/foo", line 5, in <module> > from pkg_resources import load_entry_point > File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", > line 3084, in <module> > @_call_aside > File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", > line 3070, in _call_aside > f(*args, **kwargs) > File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", > line 3097, in _initialize_master_working_set > working_set = WorkingSet._build_master() > File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", > line 651, in _build_master > ws.require(__requires__) > File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", > line 952, in require > needed = self.resolve(parse_requirements(requirements)) > File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", > line 839, in resolve > raise DistributionNotFound(req, requirers) > pkg_resources.DistributionNotFound: The FooApp==1.2.3' distribution > was not found and is required by the application > > Other queries to `pkg_resources` for this application's distribution, > for example to get the distribution version or homepage URL, will also > fail. > > How can I have Pybuild specify to Distutils that the application's > library modules should be installed away from the public namespace and > not available for general import, but also that the `pkg_resources` > functionality should find the distribution metadata where expected? > > -- > \ “When I was a kid I used to pray every night for a new bicycle. | > `\ Then I realised that the Lord doesn't work that way so I stole | > _o__) one and asked Him to forgive me.” —Emo Philips | > Ben Finney > >