diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2017-07-23 15:49:26 -0400 |
|---|---|---|
| committer | Jason R. Coombs <jaraco@jaraco.com> | 2017-07-23 15:49:26 -0400 |
| commit | 77044955def37aa95310224d6b8436a8f8e0c6d3 (patch) | |
| tree | 43d241d08a9050f426a6105dada8e1fc7e0409ac /setuptools/dist.py | |
| parent | b812935899dec7e7afea3ea0ae0f5a9b3169f741 (diff) | |
| download | external_python_setuptools-77044955def37aa95310224d6b8436a8f8e0c6d3.tar.gz external_python_setuptools-77044955def37aa95310224d6b8436a8f8e0c6d3.tar.bz2 external_python_setuptools-77044955def37aa95310224d6b8436a8f8e0c6d3.zip | |
Refactor a bit for clarity
Diffstat (limited to 'setuptools/dist.py')
| -rw-r--r-- | setuptools/dist.py | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/setuptools/dist.py b/setuptools/dist.py index cf25c64d..88bdf5aa 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -379,23 +379,26 @@ class Distribution(Distribution_parse_config_files, _Distribution): Move requirements in `install_requires` that are using environment markers or extras to `extras_require`. """ + + # divide the install_requires into two sets, simple ones still + # handled by install_requires and more complex ones handled + # by extras_require. + def is_simple_req(req): return not req.marker and not req.extras spec_inst_reqs = getattr(self, 'install_requires', None) or () - self.install_requires = list( - str(req) - for req in filter( - is_simple_req, - pkg_resources.parse_requirements(spec_inst_reqs), - ) + simple_reqs = filter( + is_simple_req, + pkg_resources.parse_requirements(spec_inst_reqs), ) - - markers_or_extras_reqs = filterfalse( + complex_reqs = filterfalse( is_simple_req, pkg_resources.parse_requirements(spec_inst_reqs), ) - for r in markers_or_extras_reqs: + self.install_requires = list(map(str, simple_reqs)) + + for r in complex_reqs: suffix = ':' + str(r.marker) if r.marker else '' sections = [ section + suffix |
