New submission from ILja Orlovs:
When `requires` list is present in the `distutils.core.setup` object, each
element of that list is being parsed by `VersionPredicate` object (located in
the `distutils/versionpredicate.py` file).
In its `__init__` method, the VersionPredicate uses `re_validPackage` regexp
object (line 105 in my local `distutils/versionpredicate.py` file) to separate
package name from its version postfix.
The `re_validPackage` regexp is declared as
"(?i)^\s*([a-z_]\w*(?:\.[a-z_]\w*)*)(.*)".
AFAICU, this regexp is meant to separate package name (possibly dot-separated).
However, in some Linux'es (e.g. CentOs) some packages are actually
dash-separated (e.g. "rpm-build". Technically that's minus sign, of course.).
This mismatch leads to the following error when "rpm-build" is listed in
"requires" section of a `setup` object:
{{{
$ python setup.py bdist
Traceback (most recent call last):
File "setup.py", line 14, in
package_dir = {...}
File "/usr/lib64/python2.6/distutils/core.py", line 113, in setup
_setup_distribution = dist = klass(attrs)
File "/usr/lib64/python2.6/distutils/dist.py", line 258, in __init__
getattr(self.metadata, "set_" + key)(val)
File "/usr/lib64/python2.6/distutils/dist.py", line 1196, in set_requires
distutils.versionpredicate.VersionPredicate(v)
File "/usr/lib64/python2.6/distutils/versionpredicate.py", line 112, in
__init__
raise ValueError("expected parenthesized list: %r" % paren)
ValueError: expected parenthesized list: '-build'
}}}
Is suggest that `re_validPackage` regexp is changed to the
"(?i)^\s*([a-z_]\w*(?:[.-][a-z_]\w*)*)(.*)" to accommodate for such package
names.
--
assignee: eric.araujo
components: Distutils
messages: 184869
nosy: eric.araujo, ilja_o, tarek
priority: normal
severity: normal
status: open
title: Incorrect package version predicate parsing by distutils
type: behavior
versions: Python 2.7
___
Python tracker
<http://bugs.python.org/issue17509>
___
___
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com