Commit abaf7c4d authored by Marcel Bargull's avatar Marcel Bargull

Fixes #999: support python_requires, py_modules in configuration files

parent bdbe0776
...@@ -2425,6 +2425,7 @@ zip_safe bool ...@@ -2425,6 +2425,7 @@ zip_safe bool
setup_requires list-semi setup_requires list-semi
install_requires list-semi install_requires list-semi
extras_require section extras_require section
python_requires str
entry_points file:, section entry_points file:, section
use_2to3 bool use_2to3 bool
use_2to3_fixers list-comma use_2to3_fixers list-comma
...@@ -2440,6 +2441,7 @@ package_dir dict ...@@ -2440,6 +2441,7 @@ package_dir dict
package_data section package_data section
exclude_package_data section exclude_package_data section
namespace_packages list-comma namespace_packages list-comma
py_modules list-comma
======================= ===== ======================= =====
.. note:: .. note::
......
...@@ -462,6 +462,7 @@ class ConfigOptionsHandler(ConfigHandler): ...@@ -462,6 +462,7 @@ class ConfigOptionsHandler(ConfigHandler):
'tests_require': parse_list_semicolon, 'tests_require': parse_list_semicolon,
'packages': self._parse_packages, 'packages': self._parse_packages,
'entry_points': self._parse_file, 'entry_points': self._parse_file,
'py_modules': parse_list,
} }
def _parse_packages(self, value): def _parse_packages(self, value):
......
...@@ -166,7 +166,7 @@ def check_specifier(dist, attr, value): ...@@ -166,7 +166,7 @@ def check_specifier(dist, attr, value):
packaging.specifiers.SpecifierSet(value) packaging.specifiers.SpecifierSet(value)
except packaging.specifiers.InvalidSpecifier as error: except packaging.specifiers.InvalidSpecifier as error:
tmpl = ( tmpl = (
"{attr!r} must be a string or list of strings " "{attr!r} must be a string "
"containing valid version specifiers; {error}" "containing valid version specifiers; {error}"
) )
raise DistutilsSetupError(tmpl.format(attr=attr, error=error)) raise DistutilsSetupError(tmpl.format(attr=attr, error=error))
...@@ -353,6 +353,8 @@ class Distribution(Distribution_parse_config_files, _Distribution): ...@@ -353,6 +353,8 @@ 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.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"""
......
...@@ -312,6 +312,8 @@ class TestOptions: ...@@ -312,6 +312,8 @@ class TestOptions:
'setup_requires = docutils>=0.3; spack ==1.1, ==1.3; there\n' 'setup_requires = docutils>=0.3; spack ==1.1, ==1.3; there\n'
'dependency_links = http://some.com/here/1, ' 'dependency_links = http://some.com/here/1, '
'http://some.com/there/2\n' 'http://some.com/there/2\n'
'python_requires = >=1.0, !=2.8\n'
'py_modules = module1, module2\n'
) )
with get_dist(tmpdir) as dist: with get_dist(tmpdir) as dist:
assert dist.zip_safe assert dist.zip_safe
...@@ -340,6 +342,8 @@ class TestOptions: ...@@ -340,6 +342,8 @@ class TestOptions:
'there' 'there'
]) ])
assert dist.tests_require == ['mock==0.7.2', 'pytest'] assert dist.tests_require == ['mock==0.7.2', 'pytest']
assert dist.python_requires == '>=1.0, !=2.8'
assert dist.py_modules == ['module1', 'module2']
def test_multiline(self, tmpdir): def test_multiline(self, tmpdir):
fake_env( fake_env(
......
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