parse_requirements('setuptools') does not translate to distribute

Issue #98 new
Sridhar Ratnakumar
created an issue



r, = pkg_resources.parse_requirements('setuptools') print r.project_name setuptools }}}

I noticed that "easy_install setuptools" does not install anything noting that distribute is already installed. But why does not parse_requirement behave in a similar manner?

PyPM interfaces with setuptools through the API only, and not the command line tools. It would be nice to have this support built into distribute, otherwise we have to hardcode this transformation in PyPM itself.

PS: I stumbled upon this issue while replacing setuptools with distribute in PyPM and the repositories (it is still in an experimental branch though).

Comments (7)

  1. Tarek Ziadé repo owner

    I am not sure what you mean here, Distribute will return itself when setuptools is asked, through APIs like "find" etc:

    >>> from pkg_resources import working_set, Requirement
    >>> working_set.find(Requirement.parse('setuptools'))
    distribute 0.6.9dev (/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/distribute-0.6.9dev-py2.6.egg)

    What different behavior are you expecting ?

  2. Sridhar Ratnakumar reporter

    The behavior I expected was:

    >>> r, = pkg_resources.parse_requirements('setuptools')
    >>> print r.project_name

    pkg_resources.Requirement already does some transformation of name and version via safe_name(...) and safe_version(..). So I thought it is natural for it to also transform 'setuptools' to 'distribute'.

  3. Tarek Ziadé repo owner

    The problem is that this would break any software out there that checks the project_name, so the faking would be inconsistent : some code ask for a project called "setuptools" and get another name. This would break for instance zc.buildout.

    In what case would you need that behavior for precisely ?

  4. Sridhar Ratnakumar reporter

    Well, actually it seems that I am not understanding the problem well enough.

    Because I just realized that "pip install setuptools" finds distribute and stops finding setuptools. I did a "grep distribute" and couldn't find anything. I wonder how pip converts setuptools in command-line to distribute (it does not seem to use easy_install).

    Should I be something other ``parse_requirements`` in order to install distribute when user specified setuptools in the command line?

  5. Log in to comment