Commit 558ed858 authored by Benoit Pierre's avatar Benoit Pierre Committed by GitHub

Merge pull request #1108 from benoit-pierre/fix_requires_handling,_again

fix requires handling when using setup.cfg
parents 28e2625c 096f3287
...@@ -349,14 +349,15 @@ class Distribution(Distribution_parse_config_files, _Distribution): ...@@ -349,14 +349,15 @@ class Distribution(Distribution_parse_config_files, _Distribution):
"setuptools, pip, and PyPI. Please see PEP 440 for more " "setuptools, pip, and PyPI. Please see PEP 440 for more "
"details." % self.metadata.version "details." % self.metadata.version
) )
if getattr(self, 'python_requires', None):
self.metadata.python_requires = self.python_requires
self._finalize_requires() self._finalize_requires()
def _finalize_requires(self): def _finalize_requires(self):
""" """
Fix environment markers in `install_requires` and `extras_require`. Set `metadata.python_requires` and fix environment markers
in `install_requires` and `extras_require`.
""" """
if getattr(self, 'python_requires', None):
self.metadata.python_requires = self.python_requires
self._convert_extras_requirements() self._convert_extras_requirements()
self._move_install_requirements_markers() self._move_install_requirements_markers()
...@@ -424,8 +425,7 @@ class Distribution(Distribution_parse_config_files, _Distribution): ...@@ -424,8 +425,7 @@ class Distribution(Distribution_parse_config_files, _Distribution):
_Distribution.parse_config_files(self, filenames=filenames) _Distribution.parse_config_files(self, filenames=filenames)
parse_configuration(self, self.command_options) parse_configuration(self, self.command_options)
if getattr(self, 'python_requires', None): self._finalize_requires()
self.metadata.python_requires = self.python_requires
def parse_command_line(self): def parse_command_line(self):
"""Process features after parsing command line options""" """Process features after parsing command line options"""
......
...@@ -333,7 +333,7 @@ class TestOptions: ...@@ -333,7 +333,7 @@ class TestOptions:
]) ])
assert dist.install_requires == ([ assert dist.install_requires == ([
'docutils>=0.3', 'docutils>=0.3',
'pack ==1.1, ==1.3', 'pack==1.1,==1.3',
'hey' 'hey'
]) ])
assert dist.setup_requires == ([ assert dist.setup_requires == ([
...@@ -403,7 +403,7 @@ class TestOptions: ...@@ -403,7 +403,7 @@ class TestOptions:
]) ])
assert dist.install_requires == ([ assert dist.install_requires == ([
'docutils>=0.3', 'docutils>=0.3',
'pack ==1.1, ==1.3', 'pack==1.1,==1.3',
'hey' 'hey'
]) ])
assert dist.setup_requires == ([ assert dist.setup_requires == ([
...@@ -508,7 +508,7 @@ class TestOptions: ...@@ -508,7 +508,7 @@ class TestOptions:
with get_dist(tmpdir) as dist: with get_dist(tmpdir) as dist:
assert dist.extras_require == { assert dist.extras_require == {
'pdf': ['ReportLab>=1.2', 'RXP'], 'pdf': ['ReportLab>=1.2', 'RXP'],
'rest': ['docutils>=0.3', 'pack ==1.1, ==1.3'] 'rest': ['docutils>=0.3', 'pack==1.1,==1.3']
} }
def test_entry_points(self, tmpdir): def test_entry_points(self, tmpdir):
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment