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
d25e2a58
Commit
d25e2a58
authored
Mar 29, 2016
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Plain Diff
Merge
https://bitbucket.org/pypa/setuptools/pull-requests/185
.
parents
2f95af84
2d8cb894
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
74 additions
and
10 deletions
+74
-10
CHANGES.txt
CHANGES.txt
+10
-2
pkg_resources/__init__.py
pkg_resources/__init__.py
+4
-0
pkg_resources/tests/test_resources.py
pkg_resources/tests/test_resources.py
+5
-0
setuptools/tests/test_egg_info.py
setuptools/tests/test_egg_info.py
+55
-8
No files found.
CHANGES.txt
View file @
d25e2a58
...
...
@@ -2,11 +2,19 @@
CHANGES
=======
20.5
----
* BB Pull Request #185: Add support for environment markers
in requirements in install_requires, setup_requires,
tests_require as well as adding a test for the existing
extra_requires machinery.
20.4
----
* Issue #422: Moved hosting to
`Github
<https://github.com/pypa/setuptools>`_
* Issue #422: Moved hosting to
`Github
<https://github.com/pypa/setuptools>`_
from `Bitbucket <https://bitbucket.org/pypa/setuptools>`_.
Issues have been migrated, though all issues and comments
are attributed to bb-migration. So if you have a particular
...
...
pkg_resources/__init__.py
View file @
d25e2a58
...
...
@@ -809,6 +809,10 @@ class WorkingSet(object):
if req in processed:
# Ignore cyclic or redundant dependencies
continue
# If the req has a marker, evaluate it -- skipping the req if
# it evaluates to False.
if req.marker and not req.marker.evaluate():
continue
dist = best.get(req.key)
if dist is None:
# Find the best distribution and add it to the map
...
...
pkg_resources/tests/test_resources.py
View file @
d25e2a58
...
...
@@ -182,6 +182,11 @@ class TestDistro:
msg
=
'Foo 0.9 is installed but Foo==1.2 is required'
assert
vc
.
value
.
report
()
==
msg
ws
=
WorkingSet
([])
# reset
# Environment markers are evaluated at resolution time
res
=
ws
.
resolve
(
parse_requirements
(
"Foo;python_version<'2'"
),
ad
)
assert
list
(
res
)
==
[]
def
testDistroDependsOptions
(
self
):
d
=
self
.
distRequires
(
"""
Twisted>=1.5
...
...
setuptools/tests/test_egg_info.py
View file @
d25e2a58
import
os
import
glob
import
stat
from
setuptools.extern.six.moves
import
map
...
...
@@ -89,17 +90,61 @@ class TestEggInfo(object):
sources_txt
=
os
.
path
.
join
(
egg_info_dir
,
'SOURCES.txt'
)
assert
'docs/usage.rst'
in
open
(
sources_txt
).
read
().
split
(
'
\
n
'
)
def
_run_install_command
(
self
,
tmpdir_cwd
,
env
):
def
_setup_script_with_requires
(
self
,
requires_line
):
setup_script
=
DALS
(
"""
from setuptools import setup
setup(
name='foo',
%s
zip_safe=False,
)
"""
%
requires_line
)
build_files
({
'setup.py'
:
setup_script
,
})
def
test_install_requires_with_markers
(
self
,
tmpdir_cwd
,
env
):
self
.
_setup_script_with_requires
(
"""install_requires=["barbazquux;python_version<'2'"],"""
)
self
.
_run_install_command
(
tmpdir_cwd
,
env
)
egg_info_dir
=
self
.
_find_egg_info_files
(
env
.
paths
[
'lib'
]).
base
requires_txt
=
os
.
path
.
join
(
egg_info_dir
,
'requires.txt'
)
assert
"barbazquux;python_version<'2'"
in
open
(
requires_txt
).
read
().
split
(
'
\
n
'
)
assert
glob
.
glob
(
os
.
path
.
join
(
env
.
paths
[
'lib'
],
'barbazquux*'
))
==
[]
def
test_setup_requires_with_markers
(
self
,
tmpdir_cwd
,
env
):
self
.
_setup_script_with_requires
(
"""setup_requires=["barbazquux;python_version<'2'"],"""
)
self
.
_run_install_command
(
tmpdir_cwd
,
env
)
assert
glob
.
glob
(
os
.
path
.
join
(
env
.
paths
[
'lib'
],
'barbazquux*'
))
==
[]
def
test_tests_require_with_markers
(
self
,
tmpdir_cwd
,
env
):
self
.
_setup_script_with_requires
(
"""tests_require=["barbazquux;python_version<'2'"],"""
)
data
=
self
.
_run_install_command
(
tmpdir_cwd
,
env
,
cmd
=
[
'test'
],
output
=
"Ran 0 tests in"
)
assert
glob
.
glob
(
os
.
path
.
join
(
env
.
paths
[
'lib'
],
'barbazquux*'
))
==
[]
def
test_extra_requires_with_markers
(
self
,
tmpdir_cwd
,
env
):
self
.
_setup_script_with_requires
(
"""extra_requires={":python_version<'2'": ["barbazquux"]},"""
)
self
.
_run_install_command
(
tmpdir_cwd
,
env
)
assert
glob
.
glob
(
os
.
path
.
join
(
env
.
paths
[
'lib'
],
'barbazquux*'
))
==
[]
def
_run_install_command
(
self
,
tmpdir_cwd
,
env
,
cmd
=
None
,
output
=
None
):
environ
=
os
.
environ
.
copy
().
update
(
HOME
=
env
.
paths
[
'home'
],
)
cmd
=
[
'install'
,
'--home'
,
env
.
paths
[
'home'
],
'--install-lib'
,
env
.
paths
[
'lib'
],
'--install-scripts'
,
env
.
paths
[
'scripts'
],
'--install-data'
,
env
.
paths
[
'data'
],
]
if
cmd
is
None
:
cmd
=
[
'install'
,
'--home'
,
env
.
paths
[
'home'
],
'--install-lib'
,
env
.
paths
[
'lib'
],
'--install-scripts'
,
env
.
paths
[
'scripts'
],
'--install-data'
,
env
.
paths
[
'data'
],
]
code
,
data
=
environment
.
run_setup_py
(
cmd
=
cmd
,
pypath
=
os
.
pathsep
.
join
([
env
.
paths
[
'lib'
],
str
(
tmpdir_cwd
)]),
...
...
@@ -108,6 +153,8 @@ class TestEggInfo(object):
)
if
code
:
raise
AssertionError
(
data
)
if
output
:
assert
output
in
data
def
_find_egg_info_files
(
self
,
root
):
class
DirList
(
list
):
...
...
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