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

Phillip J. Eby pje at telecommunity.com
Sat Dec 31 06:30:17 CET 2005


At 11:45 AM 12/31/2005 +0800, Jeff Pitman wrote:
>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

The format used by setuptools condenses non-alphanumeric runs to a single 
'-' in the project's actual name and version; these are then transposed to 
a '_' in filenames, with '-' to separate name parts.  The canonical form is 
'-', but the .egg-info directory format previously didn't transpose it to 
'_'.  This caused a problem when support for versioned .egg-info was added 
to support system packages.  I didn't realize that the setup-directory 
.egg-info wasn't being translated.  Anyway, this is fixed now in the SVN 
version; all of the other places in setuptools that worked with '-'/'_' 
filenames were using the same (correct) code to do the processing.  The 
relevant .egg-info code, however, was different, because it needed to *not* 
include the version number, so it couldn't use the standard dist.egg_name() 
method to generate a properly escaped filename including the version, 
Python version, etc.



More information about the Distutils-SIG mailing list