summaryrefslogtreecommitdiff
path: root/setuptools/command/sdist.py
diff options
context:
space:
mode:
Diffstat (limited to 'setuptools/command/sdist.py')
-rw-r--r--setuptools/command/sdist.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/setuptools/command/sdist.py b/setuptools/command/sdist.py
index bcfae4d8..dc253981 100644
--- a/setuptools/command/sdist.py
+++ b/setuptools/command/sdist.py
@@ -198,3 +198,24 @@ class sdist(sdist_add_defaults, orig.sdist):
continue
self.filelist.append(line)
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.
+ """
+
+ opts = self.distribution.get_option_dict('metadata')
+
+ # ignore the source of the value
+ _, license_file = opts.get('license_file', (None, None))
+
+ if license_file is None:
+ log.debug("'license_file' option was not specified")
+ return
+
+ if not os.path.exists(license_file):
+ log.warn("warning: Failed to find the configured license file '%s'",
+ license_file)
+ return
+
+ self.filelist.append(license_file)