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

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...
Hi all. Due to the recent addition of versioned '.egg-info' support for system packages, you may have to rename any current '.egg-info' if your project name has a '-' in it. 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.
I've added code to the latest SVN setuptools to detect this problem and warn you about it, as well as tell you what you should rename the .egg-info directory to.
If you have a '-' in your project's name, and you are using an 0.6a9dev version of setuptools, you should upgrade and rename the .egg-info directory. If you distribute any source releases of your project or have users tracking SVN or CVS releases of it, you *must* make your project require setuptools>=0.6a9dev_r41857, by passing it to ez_setup, e.g.::
from ez_setup import use_setuptools use_setuptools('0.6a9dev_r41857', 'http://some/dir/to/download/the/egg/from/')
If you do not do this, and a user has an older version of setuptools, they will encounter problems.
If you wait for the official release of 0.6a9 to upgrade, and you use its ez_setup.py or ez_setup/__init__.py, you can avoid having to change the setup script as shown.
Again, all this applies only to projects with a '-' in their names, and only if *you* are upgrading from 0.6a8 to an 0.6a9 development or final release. Your project's users can upgrade to 0.6a9 without breakage, as there is a backward compatibility mode for everything but "setup.py develop" (which will refuse to run until the .egg-info directory has been renamed).

On 12/31/05, Phillip J. Eby pje@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
participants (2)
-
Jeff Pitman
-
Phillip J. Eby