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
dd5caefb
Commit
dd5caefb
authored
Apr 15, 2016
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Always inject extra into the environment when evaluating markers. Fixes #544.
parent
bc351609
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
11 deletions
+9
-11
CHANGES.rst
CHANGES.rst
+6
-0
pkg_resources/__init__.py
pkg_resources/__init__.py
+2
-2
pkg_resources/tests/test_resources.py
pkg_resources/tests/test_resources.py
+1
-9
No files found.
CHANGES.rst
View file @
dd5caefb
...
@@ -2,6 +2,12 @@
...
@@ -2,6 +2,12 @@
CHANGES
CHANGES
=======
=======
v20
.8.1
-------
*
Issue
#
544
:
Fix
issue
with
extra
environment
marker
processing
in
WorkingSet
due
to
refactor
in
v20
.7.0
.
v20
.8.0
v20
.8.0
-------
-------
...
...
pkg_resources/__init__.py
View file @
dd5caefb
...
@@ -988,9 +988,9 @@ class _ReqExtras(dict):
...
@@ -988,9 +988,9 @@ class _ReqExtras(dict):
"""
"""
extra_evals = (
extra_evals = (
req.marker.evaluate({'extra': extra})
req.marker.evaluate({'extra': extra})
for extra in self.get(req, ())
for extra in self.get(req, ())
+ (None,)
)
)
return not req.marker or any(extra_evals)
or req.marker.evaluate()
return not req.marker or any(extra_evals)
class Environment(object):
class Environment(object):
...
...
pkg_resources/tests/test_resources.py
View file @
dd5caefb
...
@@ -189,7 +189,7 @@ class TestDistro:
...
@@ -189,7 +189,7 @@ class TestDistro:
def
test_environment_marker_evaluation_called
(
self
):
def
test_environment_marker_evaluation_called
(
self
):
"""
"""
If one package foo requires bar without any extras,
If one package foo requires bar without any extras,
markers should pass for bar.
markers should pass for bar
without extras
.
"""
"""
parent_req
,
=
parse_requirements
(
"foo"
)
parent_req
,
=
parse_requirements
(
"foo"
)
req
,
=
parse_requirements
(
"bar;python_version>='2'"
)
req
,
=
parse_requirements
(
"bar;python_version>='2'"
)
...
@@ -201,14 +201,6 @@ class TestDistro:
...
@@ -201,14 +201,6 @@ class TestDistro:
req_extras
=
pkg_resources
.
_ReqExtras
({
req
:
parent_req
.
extras
})
req_extras
=
pkg_resources
.
_ReqExtras
({
req
:
parent_req
.
extras
})
assert
req_extras
.
markers_pass
(
req
)
assert
req_extras
.
markers_pass
(
req
)
# extra should not be present in the marker namespace if
# no markers were supplied
parent_req
,
=
parse_requirements
(
"foo"
)
req
,
=
parse_requirements
(
"bar;extra==''"
)
req_extras
=
pkg_resources
.
_ReqExtras
({
req
:
parent_req
.
extras
})
with
pytest
.
raises
(
packaging
.
markers
.
UndefinedEnvironmentName
):
req_extras
.
markers_pass
(
req
)
def
test_marker_evaluation_with_extras
(
self
):
def
test_marker_evaluation_with_extras
(
self
):
"""Extras are also evaluated as markers at resolution time."""
"""Extras are also evaluated as markers at resolution time."""
ad
=
pkg_resources
.
Environment
([])
ad
=
pkg_resources
.
Environment
([])
...
...
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