summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorÉric Araujo <merwok@netwok.org>2011-06-10 22:21:18 (GMT)
committerÉric Araujo <merwok@netwok.org>2011-06-10 22:21:18 (GMT)
commit8474f2901b78cc9afe9487ed9236430f43be18b7 (patch)
tree34788008e4499f2ab0ee19d9c7c36bc0d8e644eb
parent3605030c9b8b86c805c560ddab6613ddba451de1 (diff)
downloadcpython-8474f2901b78cc9afe9487ed9236430f43be18b7.zip
cpython-8474f2901b78cc9afe9487ed9236430f43be18b7.tar.gz
cpython-8474f2901b78cc9afe9487ed9236430f43be18b7.tar.bz2
setup.cfg: Document that description-file can contain more than one file
-rw-r--r--Doc/packaging/setupcfg.rst1
-rw-r--r--Lib/packaging/config.py13
-rw-r--r--Lib/packaging/tests/test_config.py2
3 files changed, 7 insertions, 9 deletions
diff --git a/Doc/packaging/setupcfg.rst b/Doc/packaging/setupcfg.rst
index aa8216f..463522b 100644
--- a/Doc/packaging/setupcfg.rst
+++ b/Doc/packaging/setupcfg.rst
@@ -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*
diff --git a/Lib/packaging/config.py b/Lib/packaging/config.py
index be75da9..3427d9a 100644
--- a/Lib/packaging/config.py
+++ b/Lib/packaging/config.py
@@ -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):
diff --git a/Lib/packaging/tests/test_config.py b/Lib/packaging/tests/test_config.py
index 9198ead..1669862 100644
--- a/Lib/packaging/tests/test_config.py
+++ b/Lib/packaging/tests/test_config.py
@@ -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')