diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2017-07-23 16:14:55 -0400 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2017-07-23 16:14:55 -0400 |
commit | a440f728c0066f284e0d2246026264c7166a8bf5 (patch) | |
tree | b066b4d6f8825f9084673731bae06d15d6851b64 /setuptools/dist.py | |
parent | e144d98e8b38ee3440ad4fbf28c085e057858806 (diff) | |
download | external_python_setuptools-a440f728c0066f284e0d2246026264c7166a8bf5.tar.gz external_python_setuptools-a440f728c0066f284e0d2246026264c7166a8bf5.tar.bz2 external_python_setuptools-a440f728c0066f284e0d2246026264c7166a8bf5.zip |
Extract method capturing the 'suffix' for a marker.
Diffstat (limited to 'setuptools/dist.py')
-rw-r--r-- | setuptools/dist.py | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/setuptools/dist.py b/setuptools/dist.py index c4a42183..d1472a34 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -370,9 +370,17 @@ class Distribution(Distribution_parse_config_files, _Distribution): self._tmp_extras_require = defaultdict(list) for section, v in spec_ext_reqs.items(): for r in pkg_resources.parse_requirements(v): - suffix = ':' + str(r.marker) if r.marker else '' + suffix = self._suffix_for(r) self._tmp_extras_require[section + suffix].append(r) + @staticmethod + def _suffix_for(req): + """ + For a requirement, return the 'extras_require' suffix for + that requirement. + """ + return ':' + str(req.marker) if req.marker else '' + def _move_install_requirements_markers(self): """ Move requirements in `install_requires` that are using environment @@ -393,9 +401,13 @@ class Distribution(Distribution_parse_config_files, _Distribution): self.install_requires = list(map(str, simple_reqs)) for r in complex_reqs: - suffix = ':' + str(r.marker) if r.marker else '' - for section in r.extras or ('',): - self._tmp_extras_require[section + suffix].append(r) + sections = ( + section + self._suffix_for(r) + for section in r.extras or ('',) + ) + for section in sections: + self._tmp_extras_require[section].append(r) + self.extras_require = dict( (k, [str(r) for r in map(self._clean_req, v)]) for k, v in self._tmp_extras_require.items() |