[Python-checkins] cpython: setup.cfg: Document that description-file can contain more than one file
eric.araujo
python-checkins at python.org
Sat Jun 11 20:01:43 CEST 2011
http://hg.python.org/cpython/rev/c624c08b70e1
changeset: 70791:c624c08b70e1
user: Éric Araujo <merwok at netwok.org>
date: Sat Jun 11 00:21:18 2011 +0200
summary:
setup.cfg: Document that description-file can contain more than one file
files:
Doc/packaging/setupcfg.rst | 1 +
Lib/packaging/config.py | 13 +++++--------
Lib/packaging/tests/test_config.py | 2 +-
3 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/Doc/packaging/setupcfg.rst b/Doc/packaging/setupcfg.rst
--- a/Doc/packaging/setupcfg.rst
+++ b/Doc/packaging/setupcfg.rst
@@ -285,6 +285,7 @@
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
--- a/Lib/packaging/config.py
+++ b/Lib/packaging/config.py
@@ -163,21 +163,18 @@
"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
--- a/Lib/packaging/tests/test_config.py
+++ b/Lib/packaging/tests/test_config.py
@@ -327,7 +327,7 @@
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')
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list