[Distutils] use of '_' in package name causing version parsing issue?

Brad Allen bradallen137 at gmail.com
Tue Mar 9 22:03:47 CET 2010


Today I was informed of an issue in which buildout (with the latest
setuptools) is not resolving version numbers properly, causing the
wrong package to be selected in some cases. The cause identified was
having '_' in the package name. I am still investigating this issue,
but thought it would be worth mentioning on the list in case anyone
had a quick answer.

Here is the note I received which raised the issue:

| > The problem was, they used "_" in the package
| > name.  Buildout and many other systems like setuptools,RPM,DEB etc.
| > treat "_" as a special character to distinguish package name and
| > version.
| > So, it's not a good idea to use "_" in the name of a package.
| > The same is the situation with "-" (minus/hyphen) character.
| >
| > The lesson learned: Don't use "-" and "_" in package name.
|
| >>> import pkg_resources
| >>> a="jiva_interface-2.3.6-py2.6.egg"
| >>> b="jiva_interface-2.3.8-py2.6.egg"
| >>> pkg_resources.parse_version(a)
| ('*jiva', '*_', '*interface', '*final-', '00000002', '00000003',
| '00000006', '*final-', '*py', '00000002', '00000006', '*egg',
| '*final')
| >>> pkg_resources.parse_version(b)
| ('*jiva', '*_', '*interface', '*final-', '00000002', '00000003',
| '00000008', '*final-', '*py', '00000002', '00000006', '*egg',
| '*final')
| >>> c="ZeStorage-0.1.1-py2.4.egg"
| >>> d="ZeStorage-0.1.2-py2.4.egg"
| >>> pkg_resources.parse_version(c)
| ('*zestorage', '*final-', '00000000', '00000001', '00000001',
| '*final-', '*py', '00000002', '00000004', '*egg', '*final')
| >>> pkg_resources.parse_version(d)
| ('*zestorage', '*final-', '00000000', '00000001', '00000002',
| '*final-', '*py', '00000002', '00000004', '*egg', '*final')
|


More information about the Distutils-SIG mailing list