]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
setup.cfg: Document that description-file can contain more than one file
authorÉric Araujo <merwok@netwok.org>
Fri, 10 Jun 2011 22:21:18 +0000 (00:21 +0200)
committerÉric Araujo <merwok@netwok.org>
Fri, 10 Jun 2011 22:21:18 +0000 (00:21 +0200)
Doc/packaging/setupcfg.rst
Lib/packaging/config.py
Lib/packaging/tests/test_config.py

index aa8216fdf1e2a7545c58dbb2c67faa402703d6a3..463522ba422f1e0b9fb0bdf27ffc3cf27cf6af82 100644 (file)
@@ -285,6 +285,7 @@ One extra field not present in PEP 345 is supported:
 
 description-file
    Path to a text file that will be used to fill the ``description`` field.
+   Multiple values are accepted; they must be separated by whitespace.
    ``description-file`` and ``description`` are mutually exclusive.  *optional*
 
 
index be75da98a3e278396efa44d85aa2522c44ed6fb2..3427d9ac3548a4bc90bdc09d321bf165343357b3 100644 (file)
@@ -163,21 +163,18 @@ class Config:
                                "mutually exclusive")
                         raise PackagingOptionError(msg)
 
-                    if isinstance(value, list):
-                        filenames = value
-                    else:
-                        filenames = value.split()
+                    filenames = value.split()
 
-                    # concatenate each files
-                    value = ''
+                    # concatenate all files
+                    value = []
                     for filename in filenames:
                         # will raise if file not found
                         with open(filename) as description_file:
-                            value += description_file.read().strip() + '\n'
+                            value.append(description_file.read().strip())
                         # add filename as a required file
                         if filename not in metadata.requires_files:
                             metadata.requires_files.append(filename)
-                    value = value.strip()
+                    value = '\n'.join(value).strip()
                     key = 'description'
 
                 if metadata.is_metadata_field(key):
index 9198ead131280d839f1fa10798a770fa230d630e..1669862fdfaaec18a061406f43b903ebda31906e 100644 (file)
@@ -327,7 +327,7 @@ class ConfigTestCase(support.TempdirManager,
         self.assertIn('could not import setup_hook', logs[0])
 
     def test_metadata_requires_description_files_missing(self):
-        self.write_setup({'description-file': 'README\n  README2'})
+        self.write_setup({'description-file': 'README README2'})
         self.write_file('README', 'yeah')
         self.write_file('README2', 'yeah')
         os.mkdir('src')