Imported Upstream version 36.3.0 upstream/36.3.0
authorDongHun Kwak <dh0128.kwak@samsung.com>
Mon, 14 Jan 2019 01:34:41 +0000 (10:34 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Mon, 14 Jan 2019 01:34:41 +0000 (10:34 +0900)
CHANGES.rst
docs/setuptools.txt
setup.cfg
setup.py
setuptools/config.py
setuptools/msvc.py
setuptools/tests/test_config.py

index 19afc8cb11536010bff5e6d58843bce8851f0558..1392e2a688e05463a80e07b3590345769e9f7d7f 100644 (file)
@@ -1,3 +1,9 @@
+v36.3.0
+-------
+
+* #1131: Make possible using several files within ``file:`` directive
+  in metadata.long_description in ``setup.cfg``.
+
 v36.2.7
 -------
 
index eb9fdbd3c45458da7fdb158162a8ef440f7ea868..45d746d26cab34f4a0f43b95077aa4f2f993a4e2 100644 (file)
@@ -2306,7 +2306,7 @@ boilerplate code in some cases.
     name = my_package
     version = attr: src.VERSION
     description = My package description
-    long_description = file: README.rst
+    long_description = file: README.rst, CHANGELOG.rst, LICENSE.rst
     keywords = one, two
     license = BSD 3-Clause License
     classifiers =
@@ -2379,7 +2379,7 @@ Type names used below:
 Special directives:
 
 * ``attr:`` - value could be read from module attribute
-* ``file:`` - value could be read from a file
+* ``file:`` - value could be read from a list of files and then concatenated
 
 
 .. note::
index 42531f2832033422ec2eef0b256b5a3e0c4f5838..ddc2a7229de6b6bd9d60b840c76494b2662e984f 100755 (executable)
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,5 +1,5 @@
 [bumpversion]
-current_version = 36.2.7
+current_version = 36.3.0
 commit = True
 tag = True
 
@@ -19,7 +19,7 @@ repository = https://upload.pypi.org/legacy/
 [sdist]
 formats = zip
 
-[wheel]
+[bdist_wheel]
 universal = 1
 
 [bumpversion:file:setup.py]
index 3c6d4027cb5bab32d01477a9f0ff3eb3dc70fef9..d7a13445bdaec590f0f5d18a04e9dc7e1591a157 100755 (executable)
--- a/setup.py
+++ b/setup.py
@@ -89,7 +89,7 @@ def pypi_link(pkg_filename):
 
 setup_params = dict(
     name="setuptools",
-    version="36.2.7",
+    version="36.3.0",
     description="Easily download, build, install, upgrade, and uninstall "
         "Python packages",
     author="Python Packaging Authority",
index 06a61d160c7336b8902881f7c0def3f21395878e..9a62e2ec5573d2b3cea4836a71292071ab53ba70 100644 (file)
@@ -245,33 +245,39 @@ class ConfigHandler(object):
         directory with setup.py.
 
         Examples:
-            include: LICENSE
-            include: src/file.txt
+            file: LICENSE
+            file: README.rst, CHANGELOG.md, src/file.txt
 
         :param str value:
         :rtype: str
         """
+        include_directive = 'file:'
+
         if not isinstance(value, string_types):
             return value
 
-        include_directive = 'file:'
         if not value.startswith(include_directive):
             return value
 
-        current_directory = os.getcwd()
-
-        filepath = value.replace(include_directive, '').strip()
-        filepath = os.path.abspath(filepath)
-
-        if not filepath.startswith(current_directory):
+        spec = value[len(include_directive):]
+        filepaths = (os.path.abspath(path.strip()) for path in spec.split(','))
+        return '\n'.join(
+            cls._read_file(path)
+            for path in filepaths
+            if (cls._assert_local(path) or True)
+            and os.path.isfile(path)
+        )
+
+    @staticmethod
+    def _assert_local(filepath):
+        if not filepath.startswith(os.getcwd()):
             raise DistutilsOptionError(
                 '`file:` directive can not access %s' % filepath)
 
-        if os.path.isfile(filepath):
-            with io.open(filepath, encoding='utf-8') as f:
-                value = f.read()
-
-        return value
+    @staticmethod
+    def _read_file(filepath):
+        with io.open(filepath, encoding='utf-8') as f:
+            return f.read()
 
     @classmethod
     def _parse_attr(cls, value):
index 729021aca7db69fe0d81ad24a89c784c213ede79..8e3b638fee4025cbe30489473e25bb5ee9078ae1 100644 (file)
@@ -45,9 +45,18 @@ else:
 
     safe_env = dict()
 
+_msvc9_suppress_errors = (
+    # msvc9compiler isn't available on some platforms
+    ImportError,
+    
+    # msvc9compiler raises DistutilsPlatformError in some
+    # environments. See #1118.
+    distutils.errors.DistutilsPlatformError,
+)
+
 try:
     from distutils.msvc9compiler import Reg
-except ImportError:
+except _msvc9_suppress_errors:
     pass
 
 
index dbabd69e6de39e310c9b86a3bf55a70873d8e7b1..cdfa5af43bec84ad484b85110a071360f7985bf5 100644 (file)
@@ -139,6 +139,24 @@ class TestMetadata:
             assert metadata.download_url == 'http://test.test.com/test/'
             assert metadata.maintainer_email == 'test@test.com'
 
+    def test_file_mixed(self, tmpdir):
+
+        fake_env(
+            tmpdir,
+            '[metadata]\n'
+            'long_description = file: README.rst, CHANGES.rst\n'
+            '\n'
+        )
+
+        tmpdir.join('README.rst').write('readme contents\nline2')
+        tmpdir.join('CHANGES.rst').write('changelog contents\nand stuff')
+
+        with get_dist(tmpdir) as dist:
+            assert dist.metadata.long_description == (
+                'readme contents\nline2\n'
+                'changelog contents\nand stuff'
+            )
+
     def test_file_sandboxed(self, tmpdir):
 
         fake_env(