summaryrefslogtreecommitdiff
path: root/setuptools/command
diff options
context:
space:
mode:
Diffstat (limited to 'setuptools/command')
-rw-r--r--setuptools/command/egg_info.py1
-rw-r--r--setuptools/command/sdist.py21
2 files changed, 22 insertions, 0 deletions
diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py
index d9fe3da3..5d8f451e 100644
--- a/setuptools/command/egg_info.py
+++ b/setuptools/command/egg_info.py
@@ -568,6 +568,7 @@ class manifest_maker(sdist):
def add_defaults(self):
sdist.add_defaults(self)
+ self.check_license()
self.filelist.append(self.template)
self.filelist.append(self.manifest)
rcfiles = list(walk_revctrl())
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)