mirror of
https://github.com/python/cpython.git
synced 2025-11-26 21:33:10 +00:00
setup.cfg: Document that description-file can contain more than one file
This commit is contained in:
parent
3605030c9b
commit
8474f2901b
3 changed files with 7 additions and 9 deletions
|
|
@ -285,6 +285,7 @@ One extra field not present in PEP 345 is supported:
|
||||||
|
|
||||||
description-file
|
description-file
|
||||||
Path to a text file that will be used to fill the ``description`` field.
|
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*
|
``description-file`` and ``description`` are mutually exclusive. *optional*
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -163,21 +163,18 @@ class Config:
|
||||||
"mutually exclusive")
|
"mutually exclusive")
|
||||||
raise PackagingOptionError(msg)
|
raise PackagingOptionError(msg)
|
||||||
|
|
||||||
if isinstance(value, list):
|
filenames = value.split()
|
||||||
filenames = value
|
|
||||||
else:
|
|
||||||
filenames = value.split()
|
|
||||||
|
|
||||||
# concatenate each files
|
# concatenate all files
|
||||||
value = ''
|
value = []
|
||||||
for filename in filenames:
|
for filename in filenames:
|
||||||
# will raise if file not found
|
# will raise if file not found
|
||||||
with open(filename) as description_file:
|
with open(filename) as description_file:
|
||||||
value += description_file.read().strip() + '\n'
|
value.append(description_file.read().strip())
|
||||||
# add filename as a required file
|
# add filename as a required file
|
||||||
if filename not in metadata.requires_files:
|
if filename not in metadata.requires_files:
|
||||||
metadata.requires_files.append(filename)
|
metadata.requires_files.append(filename)
|
||||||
value = value.strip()
|
value = '\n'.join(value).strip()
|
||||||
key = 'description'
|
key = 'description'
|
||||||
|
|
||||||
if metadata.is_metadata_field(key):
|
if metadata.is_metadata_field(key):
|
||||||
|
|
|
||||||
|
|
@ -327,7 +327,7 @@ class ConfigTestCase(support.TempdirManager,
|
||||||
self.assertIn('could not import setup_hook', logs[0])
|
self.assertIn('could not import setup_hook', logs[0])
|
||||||
|
|
||||||
def test_metadata_requires_description_files_missing(self):
|
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('README', 'yeah')
|
||||||
self.write_file('README2', 'yeah')
|
self.write_file('README2', 'yeah')
|
||||||
os.mkdir('src')
|
os.mkdir('src')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue