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
b8129358
Commit
b8129358
authored
Jul 23, 2017
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Consolidate logic around a 'simple' requirement
parent
f464c4b8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
+11
-7
setuptools/dist.py
setuptools/dist.py
+11
-7
No files found.
setuptools/dist.py
View file @
b8129358
...
@@ -16,7 +16,7 @@ from distutils.errors import (
...
@@ -16,7 +16,7 @@ from distutils.errors import (
from
distutils.util
import
rfc822_escape
from
distutils.util
import
rfc822_escape
from
setuptools.extern
import
six
from
setuptools.extern
import
six
from
setuptools.extern.six.moves
import
map
from
setuptools.extern.six.moves
import
map
,
filter
,
filterfalse
from
pkg_resources.extern
import
packaging
from
pkg_resources.extern
import
packaging
from
setuptools.depends
import
Require
from
setuptools.depends
import
Require
...
@@ -379,17 +379,21 @@ class Distribution(Distribution_parse_config_files, _Distribution):
...
@@ -379,17 +379,21 @@ class Distribution(Distribution_parse_config_files, _Distribution):
Move requirements in `install_requires` that are using environment
Move requirements in `install_requires` that are using environment
markers or extras to `extras_require`.
markers or extras to `extras_require`.
"""
"""
def is_simple_req(req):
return not req.marker and not req.extras
spec_inst_reqs = getattr(self, '
install_requires
', None) or ()
spec_inst_reqs = getattr(self, '
install_requires
', None) or ()
self.install_requires = list(
self.install_requires = list(
str(req)
str(req)
for req in pkg_resources.parse_requirements(spec_inst_reqs)
for req in filter(
if not req.marker and not req.extras
is_simple_req,
pkg_resources.parse_requirements(spec_inst_reqs),
)
)
)
markers_or_extras_reqs = (
markers_or_extras_reqs = filterfalse(
req
is_simple_req,
for req in pkg_resources.parse_requirements(spec_inst_reqs)
pkg_resources.parse_requirements(spec_inst_reqs),
if req.marker or req.extras
)
)
for r in markers_or_extras_reqs:
for r in markers_or_extras_reqs:
suffix = '
:
' + str(r.marker) if r.marker else ''
suffix = '
:
' + str(r.marker) if r.marker else ''
...
...
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