aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Bargull <marcel.bargull@udo.edu>2017-04-07 13:42:51 +0200
committerMarcel Bargull <marcel.bargull@udo.edu>2017-04-07 13:44:35 +0200
commitabaf7c4dd76c56eb509f6a5f6caa2f8e886801b6 (patch)
tree89402fe4a6547efe8cb341883ea9f8a25305d45b
parentbdbe0776c19646e703bd0b89ad3f33e6797256a7 (diff)
downloadexternal_python_setuptools-abaf7c4dd76c56eb509f6a5f6caa2f8e886801b6.tar.gz
external_python_setuptools-abaf7c4dd76c56eb509f6a5f6caa2f8e886801b6.tar.bz2
external_python_setuptools-abaf7c4dd76c56eb509f6a5f6caa2f8e886801b6.zip
Fixes #999: support python_requires, py_modules in configuration files
-rw-r--r--docs/setuptools.txt2
-rw-r--r--setuptools/config.py1
-rw-r--r--setuptools/dist.py4
-rw-r--r--setuptools/tests/test_config.py4
4 files changed, 10 insertions, 1 deletions
diff --git a/docs/setuptools.txt b/docs/setuptools.txt
index f0da6e1d..bf5bb8ce 100644
--- a/docs/setuptools.txt
+++ b/docs/setuptools.txt
@@ -2425,6 +2425,7 @@ zip_safe bool
setup_requires list-semi
install_requires list-semi
extras_require section
+python_requires str
entry_points file:, section
use_2to3 bool
use_2to3_fixers list-comma
@@ -2440,6 +2441,7 @@ package_dir dict
package_data section
exclude_package_data section
namespace_packages list-comma
+py_modules list-comma
======================= =====
.. note::
diff --git a/setuptools/config.py b/setuptools/config.py
index 39a01f88..252f2deb 100644
--- a/setuptools/config.py
+++ b/setuptools/config.py
@@ -462,6 +462,7 @@ class ConfigOptionsHandler(ConfigHandler):
'tests_require': parse_list_semicolon,
'packages': self._parse_packages,
'entry_points': self._parse_file,
+ 'py_modules': parse_list,
}
def _parse_packages(self, value):
diff --git a/setuptools/dist.py b/setuptools/dist.py
index 71c6c288..fd1d28c2 100644
--- a/setuptools/dist.py
+++ b/setuptools/dist.py
@@ -166,7 +166,7 @@ def check_specifier(dist, attr, value):
packaging.specifiers.SpecifierSet(value)
except packaging.specifiers.InvalidSpecifier as error:
tmpl = (
- "{attr!r} must be a string or list of strings "
+ "{attr!r} must be a string "
"containing valid version specifiers; {error}"
)
raise DistutilsSetupError(tmpl.format(attr=attr, error=error))
@@ -353,6 +353,8 @@ class Distribution(Distribution_parse_config_files, _Distribution):
_Distribution.parse_config_files(self, filenames=filenames)
parse_configuration(self, self.command_options)
+ if getattr(self, 'python_requires', None):
+ self.metadata.python_requires = self.python_requires
def parse_command_line(self):
"""Process features after parsing command line options"""
diff --git a/setuptools/tests/test_config.py b/setuptools/tests/test_config.py
index 799fb165..8bd2a494 100644
--- a/setuptools/tests/test_config.py
+++ b/setuptools/tests/test_config.py
@@ -312,6 +312,8 @@ class TestOptions:
'setup_requires = docutils>=0.3; spack ==1.1, ==1.3; there\n'
'dependency_links = http://some.com/here/1, '
'http://some.com/there/2\n'
+ 'python_requires = >=1.0, !=2.8\n'
+ 'py_modules = module1, module2\n'
)
with get_dist(tmpdir) as dist:
assert dist.zip_safe
@@ -340,6 +342,8 @@ class TestOptions:
'there'
])
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):
fake_env(