aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/command/sdist.py
diff options
context:
space:
mode:
Diffstat (limited to 'setuptools/command/sdist.py')
-rw-r--r--setuptools/command/sdist.py28
1 files changed, 19 insertions, 9 deletions
diff --git a/setuptools/command/sdist.py b/setuptools/command/sdist.py
index dc253981..55ecdd97 100644
--- a/setuptools/command/sdist.py
+++ b/setuptools/command/sdist.py
@@ -5,7 +5,7 @@ import sys
import io
import contextlib
-from setuptools.extern import six
+from setuptools.extern import six, ordered_set
from .py36compat import sdist_add_defaults
@@ -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 = ordered_set.OrderedSet()
+
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)
+ files.remove(f)
- self.filelist.append(license_file)
+ self.filelist.extend(files)