summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorAnthon van der Neut <anthon@mnt.org>2016-01-31 10:25:02 +0100
committerAnthon van der Neut <anthon@mnt.org>2016-01-31 10:25:02 +0100
commita54094a8ef4f421a806c99615b7840cc14605c54 (patch)
tree58b8d3dca1015647938937169b19c7fd9e85739f /setup.py
parent720b785274718800ffd67bbc2f4a7cbbc1e3bd21 (diff)
downloadruamel.yaml-a54094a8ef4f421a806c99615b7840cc14605c54.tar.gz
fix wheel at 0.24 for now0.10.19
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py67
1 files changed, 50 insertions, 17 deletions
diff --git a/setup.py b/setup.py
index c6e6bff..16fd8ae 100644
--- a/setup.py
+++ b/setup.py
@@ -147,9 +147,10 @@ def _package_data(fn):
w = len(str(to_line))
for index, line in enumerate(lines):
if from_line <= index <= to_line:
- print(u"{:{}}: {}".format(index, w, line), end=u'')
+ print(u"{0:{1}}: {2}".format(index, w, line).encode('utf-8'),
+ end=u'')
if index == e.lineno - 1:
- print(u"{:{}} {}^--- {}".format(
+ print(u"{0:{1}} {2}^--- {3}".format(
u' ', w, u' ' * e.offset, e.node))
raise
break
@@ -241,7 +242,6 @@ class NameSpacePackager(object):
if self._pkg_data.get('universal'):
Distribution.is_pure = lambda *args: True
else:
- print('>>>>> distribution not pure <<<<<')
Distribution.is_pure = lambda *args: False
for x in sys.argv:
if x[0] == '-' or x == 'setup.py':
@@ -374,17 +374,39 @@ class NameSpacePackager(object):
' installs for package name {0}'.format(fn))
def entry_points(self, script_name=None, package_name=None):
+ """normally called without explicit script_name and package name
+ the default console_scripts entry depends on the existence of __main__.py:
+ if that file exists then the function main() in there is used, otherwise
+ the in __init__.py.
+
+ the _package_data entry_points key/value pair can be explicitly specified
+ including a "=" character. If the entry is True or 1 the
+ scriptname is the last part of the full package path (split on '.')
+ if the ep entry is a simple string without "=", that is assumed to be
+ the name of the script.
+ """
+ def pckg_entry_point(name):
+ return '{0}{1}:main'.format(
+ name,
+ '.__main__' if os.path.exists('__main__.py') else '',
+ )
+
ep = self._pkg_data.get('entry_points', True)
if ep is None:
return None
if ep not in [True, 1]:
- return {'console_scripts': [ep]}
+ if '=' in ep:
+ # full specification of the entry point like
+ # entry_points=['yaml = ruamel.yaml.cmd:main'],
+ return {'console_scripts': [ep]}
+ # assume that it is just the script name
+ script_name = ep
if package_name is None:
package_name = self.full_package_name
if not script_name:
script_name = package_name.split('.')[-1]
return {'console_scripts': [
- '{0} = {1}:main'.format(script_name, package_name),
+ '{0} = {1}'.format(script_name, pckg_entry_point(package_name)),
]}
@property
@@ -405,12 +427,16 @@ class NameSpacePackager(object):
@property
def license(self):
+ """return the license field from _package_data, None means MIT"""
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
+ return lic
+
+ def has_mit_lic(self):
+ return 'MIT' in self.license
@property
def description(self):
@@ -419,10 +445,10 @@ class NameSpacePackager(object):
@property
def status(self):
# αβ
- status = self._pkg_data.get('status', u'β')
- if status == u'α':
+ status = self._pkg_data.get('status', u'β').lower()
+ if status in [u'α', u'alpha']:
return (3, 'Alpha')
- elif status == u'β':
+ elif status in [u'β', u'beta']:
return (4, 'Beta')
elif u'stable' in status.lower():
return (5, 'Production/Stable')
@@ -433,14 +459,17 @@ class NameSpacePackager(object):
return [
'Development Status :: {0} - {1}'.format(*self.status),
'Intended Audience :: Developers',
- 'License :: ' + ('Other/Proprietary License'
- if self.pn(self._pkg_data.get('license')) else
- 'OSI Approved :: MIT License'),
+ 'License :: ' + ('OSI Approved :: MIT' if self.has_mit_lic()
+ else 'Other/Proprietary') + ' License',
'Operating System :: OS Independent',
'Programming Language :: Python',
] + [self.pn(x) for x in self._pkg_data.get('classifiers', [])]
@property
+ def keywords(self):
+ return self.pn(self._pkg_data.get('keywords'))
+
+ @property
def install_requires(self):
"""list of packages required for installation"""
return self._analyse_packages[0]
@@ -489,7 +518,7 @@ class NameSpacePackager(object):
@property
def data_files(self):
df = self._pkg_data.get('data_files', [])
- if self._pkg_data.get('license') is None:
+ if self.has_mit_lic():
df.append('LICENSE')
if not df:
return None
@@ -498,7 +527,7 @@ class NameSpacePackager(object):
@property
def package_data(self):
df = self._pkg_data.get('data_files', [])
- if self._pkg_data.get('license') is None:
+ if self.has_mit_lic():
# include the file
df.append('LICENSE')
# but don't install it
@@ -611,7 +640,8 @@ class BinaryDistribution(Distribution):
# # call setup
def main():
- if '--version' not in sys.argv:
+ dump_kw = '--dump-kw'
+ if dump_kw in sys.argv:
import wheel
import distutils
print('python: ', sys.version)
@@ -635,14 +665,17 @@ def main():
install_requires=nsp.install_requires,
license=nsp.license,
classifiers=nsp.classifiers,
+ keywords=nsp.keywords,
package_data=nsp.package_data,
ext_modules=nsp.ext_modules,
distclass=BinaryDistribution,
)
- if '--version' not in sys.argv and '--verbose' in sys.argv:
+ if '--version' not in sys.argv and ('--verbose' in sys.argv or dump_kw in sys.argv):
for k in sorted(kw):
v = kw[k]
- print(k, '->', v)
+ print(' "{0}": "{1}",'.format(k, v))
+ if dump_kw in sys.argv:
+ sys.argv.remove(dump_kw)
with open('README.rst') as fp:
kw['long_description'] = fp.read()
if nsp.wheel(kw, setup):