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

Path csiph.com!goblin3!goblin1!goblin.stu.neva.ru!newsfeed.CARNet.hr!news.spin.it!bofh.it!news.nic.it!robomod
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 Tue, 01 Sep 2015 06:50:02 +0200
Message-ID <q3LGa-4x7-15@gated-at.bofh.it> (permalink)
References <q3JXI-21j-5@gated-at.bofh.it>
X-Original-To Ben Finney <ben+debian@benfinney.id.au>
X-Mailbox-Line From debian-python-request@lists.debian.org Tue Sep 1 04:42:50 2015
Old-Return-Path <robertc@robertcollins.net>
X-Amavis-Spam-Status No, score=-4.85 tagged_above=-10000 required=5.3 tests=[BAYES_00=-2, FOURLA=0.1, HTML_MESSAGE=2, LDO_WHITELIST=-5, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_WEB=0.77] autolearn=no autolearn_force=no
X-Policyd-Weight DYN_NJABL=SKIP(0) NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_BL_NJABL=-1.5 CL_IP_EQ_HELO_IP=-2 (check from: .robertcollins. - helo: .mail-ob0-f181.google. - helo-domain: .google.) FROM/MX_MATCHES_HELO(DOMAIN)=-2; rate: -7
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=JmrpgEM/tcUvRetdJNAXpaSbEFEiJub+TY6yZKIKHcM=; b=fuMrJyqNdsfIpU6TyigM/sjyOyIodapzIkbh3eZ1SGn2e99bcrhwBECQfwZz7dRDqR /+4LElR9T6pTIGeYOK1uXfhYAgbsYhVtsGKxxfvazKfC1d2r8RV9s3JTp9HzfrbGBk9A dSaOhUqpjJdxsOwTvhKbduCVoWxAvlNJQ4Ec9E/p5W5ptWyLaxEVe8JIRtG64Z5HU1bN RKKHKXNS/rFUhqhJkZXvjkJnWkoWkRBsa6BTen2h9mWWY6yEtnWd7sDnfy4xdqq5aSW9 xYNh+p+Ak/pAlD0dImJVCTkP1VkuEMyP9AYX34tkJIDVQRMZZPfxJ35E4qPNpcaHFVAz wfwQ==
X-Gm-Message-State ALoCoQksoNxSahvtkBCEjT6xQjmtK5qC7uJn7pLVs0BaboJOJskx09URPucpgzko7Tduyt1Peyh7
MIME-Version 1.0
X-Received by 10.60.130.136 with SMTP id oe8mr15501385oeb.10.1441082550270; Mon, 31 Aug 2015 21:42:30 -0700 (PDT)
X-Originating-IP [122.56.205.73]
Content-Type multipart/alternative; boundary=089e0122a75c8058b4051ea82dcd
X-Mailing-List <debian-python@lists.debian.org> archive/latest/12528
List-ID <debian-python.lists.debian.org>
List-URL <https://lists.debian.org/debian-python/>
List-Archive https://lists.debian.org/msgid-search/CAJ3HoZ3tj7BHNEkdUGd9g1CstmXVDKt2USi99Vn_JisqyMQ7_A@mail.gmail.com
Approved robomod@news.nic.it
Lines 233
Organization linux.* mail to news gateway
Sender robomod@news.nic.it
X-Original-Cc Debian Python <debian-python@lists.debian.org>
X-Original-Date Tue, 1 Sep 2015 16:42:30 +1200
X-Original-Message-ID <CAJ3HoZ3tj7BHNEkdUGd9g1CstmXVDKt2USi99Vn_JisqyMQ7_A@mail.gmail.com>
X-Original-References <85bndmc0ln.fsf@benfinney.id.au>
Xref csiph.com linux.debian.maint.python:7221

Show key headers only | 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