Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
452e13ce
Commit
452e13ce
authored
Jul 30, 2016
by
Gabi Davar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix for extra names containing '-'
parent
1aa71905
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
3 deletions
+21
-3
pkg_resources/__init__.py
pkg_resources/__init__.py
+3
-3
pkg_resources/tests/test_resources.py
pkg_resources/tests/test_resources.py
+18
-0
No files found.
pkg_resources/__init__.py
View file @
452e13ce
...
...
@@ -1428,7 +1428,7 @@ def safe_extra(extra):
Any runs of non-alphanumeric characters are replaced with a single '
_
',
and the result is always lowercased.
"""
return re.sub('
[
^
A
-
Za
-
z0
-
9.
]
+
', '
_
', extra).lower()
return re.sub('
[
^
A
-
Za
-
z0
-
9.
-
]
+
', '
_
', extra).lower()
def to_filename(name):
...
...
@@ -2807,8 +2807,8 @@ class DistInfoDistribution(Distribution):
dm[None].extend(common)
for extra in self._parsed_pkg_info.get_all('Provides-Extra') or []:
extra = safe_extra(extra.strip())
dm[extra] = list(frozenset(reqs_for_extra(extra)) - common)
s_
extra = safe_extra(extra.strip())
dm[
s_
extra] = list(frozenset(reqs_for_extra(extra)) - common)
return dm
...
...
pkg_resources/tests/test_resources.py
View file @
452e13ce
...
...
@@ -221,6 +221,24 @@ class TestDistro:
res
=
list
(
ws
.
resolve
(
parse_requirements
(
"Foo[baz]"
),
ad
))
assert
res
==
[
Foo
,
quux
]
def
test_marker_evaluation_with_extras_normlized
(
self
):
"""Extras are also evaluated as markers at resolution time."""
ad
=
pkg_resources
.
Environment
([])
ws
=
WorkingSet
([])
# Metadata needs to be native strings due to cStringIO behaviour in
# 2.6, so use str().
Foo
=
Distribution
.
from_filename
(
"/foo_dir/Foo-1.2.dist-info"
,
metadata
=
Metadata
((
"METADATA"
,
str
(
"Provides-Extra: baz-lightyear
\
n
"
"Requires-Dist: quux; extra=='baz-lightyear'"
)))
)
ad
.
add
(
Foo
)
assert
list
(
ws
.
resolve
(
parse_requirements
(
"Foo"
),
ad
))
==
[
Foo
]
quux
=
Distribution
.
from_filename
(
"/foo_dir/quux-1.0.dist-info"
)
ad
.
add
(
quux
)
res
=
list
(
ws
.
resolve
(
parse_requirements
(
"Foo[baz-lightyear]"
),
ad
))
assert
res
==
[
Foo
,
quux
]
def
test_marker_evaluation_with_multiple_extras
(
self
):
ad
=
pkg_resources
.
Environment
([])
ws
=
WorkingSet
([])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment