Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.maint.python > #7221

Re: Application libraries private, Distutils metadata available for console scripts and introspection

From Robert Collins <robertc@robertcollins.net>
Newsgroups linux.debian.maint.python
Subject Re: Application libraries private, Distutils metadata available for console scripts and introspection
Date 2015-09-01 06:50 +0200
Message-ID <q3LGa-4x7-15@gated-at.bofh.it> (permalink)
References <q3JXI-21j-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

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+debian@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
>
>

Back to linux.debian.maint.python | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Application libraries private, Distutils metadata available for console scripts and introspection Ben Finney <ben+debian@benfinney.id.au> - 2015-09-01 05:00 +0200
  Re: Application libraries private, Distutils metadata available for  console scripts and introspection Robert Collins <robertc@robertcollins.net> - 2015-09-01 06:50 +0200
    Re: Application libraries private, Distutils metadata available for console scripts and introspection Ben Finney <ben+debian@benfinney.id.au> - 2015-09-01 07:40 +0200
      Re: Application libraries private, Distutils metadata available for  console scripts and introspection Robert Collins <robertc@robertcollins.net> - 2015-09-01 09:40 +0200
  Re: Application libraries private, Distutils metadata available for console scripts and introspection Ben Finney <ben+debian@benfinney.id.au> - 2015-09-01 08:10 +0200
    Re: Application libraries private, Distutils metadata available for  console scripts and introspection Piotr Ożarowski <piotr@debian.org> - 2015-09-01 12:20 +0200
  Re: Application libraries private, Distutils metadata available for console scripts and introspection Ben Finney <ben+debian@benfinney.id.au> - 2015-09-02 10:40 +0200
    Re: Application libraries private, Distutils metadata available for  console scripts and introspection Robert Collins <robertc@robertcollins.net> - 2015-09-02 11:10 +0200
      Re: Application libraries private, Distutils metadata available for  console scripts and introspection Karsten Hilbert <Karsten.Hilbert@gmx.net> - 2015-09-02 11:20 +0200
        Re: Application libraries private, Distutils metadata available for  console scripts and introspection Robert Collins <robertc@robertcollins.net> - 2015-09-02 13:30 +0200
        Re: Application libraries private, Distutils metadata available for  console scripts and introspection Barry Warsaw <barry@debian.org> - 2015-09-02 15:50 +0200
      Re: Application libraries private, Distutils metadata available for console scripts and introspection Ben Finney <ben+debian@benfinney.id.au> - 2015-09-02 12:50 +0200
        Re: Application libraries private, Distutils metadata available for  console scripts and introspection Robert Collins <robertc@robertcollins.net> - 2015-09-02 13:30 +0200
      Re: Application libraries private, Distutils metadata available for  console scripts and introspection Barry Warsaw <barry@debian.org> - 2015-09-02 15:50 +0200
    Re: Application libraries private, Distutils metadata available for  console scripts and introspection Piotr Ożarowski <piotr@debian.org> - 2015-09-03 00:20 +0200

csiph-web