aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/command/sdist.py
diff options
context:
space:
mode:
authorMick Koch <mick@kochm.co>2019-05-20 18:25:19 -0400
committerMick Koch <mick@kochm.co>2019-10-28 18:30:31 -0400
commit823ab9d2ec4ab89f90c0a781d872c9071b4afc13 (patch)
tree8c6e9f23a72bb970b8d01592aacaee4e71a442bb /setuptools/command/sdist.py
parent7748921de342160ca2dc9c9539562bb9c924e14c (diff)
downloadexternal_python_setuptools-823ab9d2ec4ab89f90c0a781d872c9071b4afc13.tar.gz
external_python_setuptools-823ab9d2ec4ab89f90c0a781d872c9071b4afc13.tar.bz2
external_python_setuptools-823ab9d2ec4ab89f90c0a781d872c9071b4afc13.zip
Add support for `license_files` option in metadata
Diffstat (limited to 'setuptools/command/sdist.py')
-rw-r--r--setuptools/command/sdist.py26
1 files changed, 18 insertions, 8 deletions
diff --git a/setuptools/command/sdist.py b/setuptools/command/sdist.py
index dc253981..24316640 100644
--- a/setuptools/command/sdist.py
+++ b/setuptools/command/sdist.py
@@ -200,10 +200,12 @@ class sdist(sdist_add_defaults, orig.sdist):
manifest.close()
def check_license(self):
- """Checks if license_file' is configured and adds it to
- 'self.filelist' if the value contains a valid path.
+ """Checks if license_file' or 'license_files' is configured and adds any
+ valid paths to 'self.filelist'.
"""
+ files = set()
+
opts = self.distribution.get_option_dict('metadata')
# ignore the source of the value
@@ -211,11 +213,19 @@ class sdist(sdist_add_defaults, orig.sdist):
if license_file is None:
log.debug("'license_file' option was not specified")
- return
+ else:
+ files.add(license_file)
- if not os.path.exists(license_file):
- log.warn("warning: Failed to find the configured license file '%s'",
- license_file)
- return
+ try:
+ files.update(self.distribution.metadata.license_files)
+ except TypeError:
+ log.warn("warning: 'license_files' option is malformed")
+
+ for f in files:
+ if not os.path.exists(f):
+ log.warn(
+ "warning: Failed to find the configured license file '%s'",
+ f)
+ continue
- self.filelist.append(license_file)
+ self.filelist.append(f)