Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement pkgutil APIs as described in PEP 376 #49158

Closed
tarekziade mannequin opened this issue Jan 10, 2009 · 14 comments
Closed

Implement pkgutil APIs as described in PEP 376 #49158

tarekziade mannequin opened this issue Jan 10, 2009 · 14 comments
Assignees
Labels
type-feature A feature request or enhancement

Comments

@tarekziade
Copy link
Mannequin

tarekziade mannequin commented Jan 10, 2009

BPO 4908
Nosy @tarekziade, @merwok
Files
  • get_metadata.diff
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/tarekziade'
    closed_at = <Date 2010-05-09.21:38:06.330>
    created_at = <Date 2009-01-10.17:45:04.747>
    labels = ['type-feature']
    title = 'Implement pkgutil APIs as described in PEP 376'
    updated_at = <Date 2010-08-21.16:58:39.682>
    user = 'https://github.com/tarekziade'

    bugs.python.org fields:

    activity = <Date 2010-08-21.16:58:39.682>
    actor = 'eric.araujo'
    assignee = 'tarek'
    closed = True
    closed_date = <Date 2010-05-09.21:38:06.330>
    closer = 'tarek'
    components = ['Distutils2']
    creation = <Date 2009-01-10.17:45:04.747>
    creator = 'tarek'
    dependencies = []
    files = ['12746']
    hgrepos = []
    issue_num = 4908
    keywords = ['patch']
    message_count = 14.0
    messages = ['79562', '79612', '79636', '79676', '79677', '79679', '79718', '79876', '80421', '80439', '80465', '94616', '102697', '114513']
    nosy_count = 7.0
    nosy_names = ['aalbrecht', 'flub', 'tarek', 'eric.araujo', 'rayterrill', 'meatballhat', 'alexis']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue4908'
    versions = ['Python 2.6', 'Python 2.5', 'Python 3.1', 'Python 2.7', 'Python 3.2']

    @tarekziade
    Copy link
    Mannequin Author

    tarekziade mannequin commented Jan 10, 2009

    Let's add a "get_metadata" API in Distutils that would return
    in a dictionary the content of the .egg-info file introduced into Python
    2.5.

      >>> from distutils import get_metadata
      >>> get_metadata('ThePackage')
      {..}

    (Working on a prototype)

    @tarekziade tarekziade mannequin added the stdlib Python modules in the Lib dir label Jan 10, 2009
    @tarekziade tarekziade mannequin self-assigned this Jan 10, 2009
    @tarekziade tarekziade mannequin added the type-feature A feature request or enhancement label Jan 10, 2009
    @tarekziade
    Copy link
    Mannequin Author

    tarekziade mannequin commented Jan 11, 2009

    It looks like the best way to do this is to:

    • make distutils.dist.DistributionMetadata also read existing egg-info files

    • add get_metadata in pkgutil instead of distutils, and make it use
      distutils.dist.DistributionMetadata

    @tarekziade
    Copy link
    Mannequin Author

    tarekziade mannequin commented Jan 11, 2009

    heres a first simple draft, that works on .egg-info files,

    (the Description extractor needs to rework, but this patch is enough to
    discuss the feature)

    @rayterrill
    Copy link
    Mannequin

    rayterrill mannequin commented Jan 12, 2009

    The patch didn't install correctly using 'patch', but I manually merged
    the changes into my environment (Ubuntu 8.10 running 2.5.2) - I'll
    upload the diff rejections if they'll be helpful.

    After installing, I attempted to use the new code to determine the
    version number, and am receiving 'None' as my result. After looking
    through the code, I believe its looking for a '.egg-info' file, but my
    custom package doesn't have one (it was installed using 'easy_install' -
    easy_install -z <package_name>), so it looks like that info is instead
    stored in EGG_INFO/PKG-INFO within the egg itself.

    Here's a dir dump of my installed egg:
    my_package-1.0-py2.5.egg/
    |-- EGG-INFO
    | |-- PKG-INFO
    | |-- SOURCES.txt
    | |-- dependency_links.txt
    | |-- top_level.txt
    | -- zip-safe |-- my_package.py -- my_package.pyc

    @tarekziade
    Copy link
    Mannequin Author

    tarekziade mannequin commented Jan 12, 2009

    yes the patch doesn't treat the eggs installed with easy_install yet,
    just plain distutils

    I'll let you know when EGG_INFO/PKG-INFO is ready (should be in the
    coming days)

    @rayterrill
    Copy link
    Mannequin

    rayterrill mannequin commented Jan 12, 2009

    I've tested it out using the straight distutils installation, and it
    works great!

    @aalbrecht
    Copy link
    Mannequin

    aalbrecht mannequin commented Jan 13, 2009

    Is it intended that when reading PKG-INFO files the PEP-314 attributes
    (provides, requires, obsoletes) are only set if version is exactly "1.1"?

    I'd expected that those attributes are available regardless of the
    metadata version of the parsed file (with None as default for PKG-INFO
    files < 1.1).

    @tarekziade
    Copy link
    Mannequin Author

    tarekziade mannequin commented Jan 14, 2009

    I have improved the patch (uploaded here) (some cases are not done yet,
    still work in progress)

    Ray, it should work with egg generated by setuptools now, (zipped as well)

    Andi, right ! -> fixed in the current patch

    @rayterrill
    Copy link
    Mannequin

    rayterrill mannequin commented Jan 23, 2009

    any chance of getting a patch that would work in 2.4?

    @tarekziade
    Copy link
    Mannequin Author

    tarekziade mannequin commented Jan 24, 2009

    Well since Python 2.4 doesn't have the egg-info feature, that is another
    story.

    @rayterrill
    Copy link
    Mannequin

    rayterrill mannequin commented Jan 24, 2009

    There wouldn't be an easy way to read the distutils setup.py info at
    all in 2.4? i suppose i could write something specific for our
    environment.

    On 1/24/09, Tarek Ziadé <report@bugs.python.org> wrote:

    Tarek Ziadé <ziade.tarek@gmail.com> added the comment:

    Well since Python 2.4 doesn't have the egg-info feature, that is another
    story.


    Python tracker <report@bugs.python.org>
    <http://bugs.python.org/issue4908\>


    @tarekziade
    Copy link
    Mannequin Author

    tarekziade mannequin commented Oct 28, 2009

    This patch will be applied for the part that makes DistributionMetadata
    load files.

    The other part is waiting for PEP-376.

    @tarekziade
    Copy link
    Mannequin Author

    tarekziade mannequin commented Apr 9, 2010

    Work done in pkgutil, in the Distutils2 project, see PEP-376 for API names.

    @tarekziade tarekziade mannequin removed the stdlib Python modules in the Lib dir label Apr 9, 2010
    @tarekziade tarekziade mannequin changed the title adding a get_metadata in distutils Implement PEP 376 Apr 9, 2010
    @tarekziade tarekziade mannequin closed this as completed May 9, 2010
    @merwok
    Copy link
    Member

    merwok commented Aug 21, 2010

    Reversing the duplicate relation with bpo-8250 since this report has more messages.

    Not reopening though, since the work is done. Kudos to Josip!

    @merwok merwok changed the title Implement PEP 376 Implement pkgutil APIs as described in PEP 376 Aug 21, 2010
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant