summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2015-08-27 19:33:42 +0200
committerAnthon van der Neut <anthon@mnt.org>2015-08-27 19:33:42 +0200
commitf99cf984a04e3765d2bac4cd51620d0f87181a92 (patch)
tree0f6b9b577b6695b2ad768ad7fe7b1157cdc741f3
parent3403025e03dd626d270f8f075fb4862daeff9878 (diff)
downloadruamel.std.argparse-f99cf984a04e3765d2bac4cd51620d0f87181a92.tar.gz
sync setup.py with wheel info
-rw-r--r--setup.py34
1 files changed, 29 insertions, 5 deletions
diff --git a/setup.py b/setup.py
index 81b3fb8..6a2fc44 100644
--- a/setup.py
+++ b/setup.py
@@ -258,11 +258,12 @@ class NameSpacePackager(object):
@property
def license(self):
- # lic = self._pkg_data.get('license')
- # if lic is None:
- # lic_file_name = os.path.join(os.path.dirname(__file__), 'LICENSE')
- # assert os.path.exists(lic_file_name)
- return "MIT license"
+ lic = self._pkg_data.get('license')
+ if lic is None:
+ # lic_fn = os.path.join(os.path.dirname(__file__), 'LICENSE')
+ # assert os.path.exists(lic_fn)
+ return "MIT license"
+ return license
@property
def description(self):
@@ -317,6 +318,27 @@ class NameSpacePackager(object):
return None
return {self.full_package_name: df}
+ def wheel(self, kw, setup):
+ """temporary add setup.cfg if creating a wheel to include LICENSE file
+ https://bitbucket.org/pypa/wheel/issues/47
+ """
+ if 'bdist_wheel' not in sys.argv or not os.path.exists('LICENSE'):
+ return
+ file_name = 'setup.cfg'
+ if os.path.exists(file_name): # add it if not in there?
+ return
+ with open(file_name, 'w') as fp:
+ fp.write('[metadata]\nlicense-file = LICENSE\n')
+ if self._pkg_data.get('universal'):
+ fp.write('[bdist_wheel]\nuniversal = 1\n')
+ try:
+ setup(**kw)
+ except:
+ raise
+ finally:
+ os.remove(file_name)
+ return True
+
# # call setup
def main():
@@ -346,6 +368,8 @@ def main():
print(k, '->', v)
with open('README.rst') as fp:
kw['long_description'] = fp.read()
+ if nsp.wheel(kw, setup):
+ return
setup(**kw)