[Distutils] Setuptools projects with '-' in their names (was Re: some kind of problem with setuptools 0.6a9)

Jeff Pitman jeff.pitman at gmail.com
Sat Dec 31 04:45:10 CET 2005


On 12/31/05, Phillip J. Eby <pje at telecommunity.com> wrote:
> At 10:04 AM 12/30/2005 -0500, Kevin Dangoor wrote:
> >The "tg-admin sql" command uses sqlobject which, in turn uses egg
> >metadata. Something I just noticed is that these commands are no
> >longer working on a project i have called "Wiki-20". They *used* to
> >work. Now they get a "DistributionNotFound" error for Wiki-20.
> >...
> >I had also tried to just do "pkg_resources.require("WIki-20")" from
> >the Python shell, but that didn't work either. This is new behavior
> >between a8 and a9. Let me know if there's anything else I can tell you
> >about the problem...

> Otherwise, recent versions of setuptools
> will think the '-' is the separator between the project name and version
> number, leading to problems like the ones described by Kevin above.

There is a standard regular expression that can be used to split out
N-V which is a pretty common thing in deb/rpm. (ie. python-foo). I use
the following in some py scripts to manage these pairings for my rpm
repo:

'(?i)(.*)-([^-]*)-(([^-]*)\.([^-]*)\.%s)(.*)'

Which is N-V-R.dist.repo.ext

The form that you might want would be:

'(.*)-([^-]*)'

Name-Version

This would allow Name to have -. Obviously, - cannot be used in Version.

Also, two side notes, 1) it's kind of annoying that package names
interchange between `-' and `_', one in the file name of the archive
and one used in the extracted directory name. 2) I've also see the use
of `_' in versioning, such as json.py. I also highly discourage that
practice.

--
-jeff


More information about the Distutils-SIG mailing list