diff options
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 36 |
1 files changed, 31 insertions, 5 deletions
@@ -44,6 +44,10 @@ if sys.version_info < (3, 4): class NameConstant: pass +if sys.version_info >= (3, 8): + + from ast import Str, Num, Bytes, NameConstant # NOQA + if sys.version_info < (3,): open_kw = dict() @@ -830,7 +834,7 @@ class NameSpacePackager(object): sources=[self.pn(x) for x in target['src']], libraries=[self.pn(x) for x in target.get('lib')], ) - # debug('test in target', 'test' in target, target) + # debug('test1 in target', 'test' in target, target) if 'test' not in target: # no test, just hope it works self._ext_modules.append(ext) continue @@ -871,8 +875,8 @@ class NameSpacePackager(object): print('compile error:', file_name) continue except LinkError: - debug('libyaml link error', file_name) - print('libyaml link error', file_name) + debug('link error', file_name) + print('link error', file_name) continue self._ext_modules.append(ext) except Exception as e: # NOQA @@ -893,10 +897,10 @@ class NameSpacePackager(object): https://bitbucket.org/pypa/wheel/issues/47 """ if 'bdist_wheel' not in sys.argv: - return + return False file_name = 'setup.cfg' if os.path.exists(file_name): # add it if not in there? - return + return False with open(file_name, 'w') as fp: if os.path.exists('LICENSE'): fp.write('[metadata]\nlicense-file = LICENSE\n') @@ -964,6 +968,8 @@ def main(): for k in sorted(kw): v = kw[k] print(' "{0}": "{1}",'.format(k, v)) + # if '--record' in sys.argv: + # return if dump_kw in sys.argv: sys.argv.remove(dump_kw) try: @@ -971,7 +977,26 @@ def main(): kw['long_description'] = fp.read() except Exception: pass + if nsp.wheel(kw, setup): + if nsp.nested and 'bdist_wheel' in sys.argv: + try: + d = sys.argv[sys.argv.index('-d') + 1] + except ValueError: + dist_base = os.environ.get('PYDISTBASE') + if dist_base: + d = os.path.join(dist_base, nsp.full_package_name) + else: + d = 'dist' + for x in os.listdir(d): + dashed_vs = '-' + version_str + '-' + if x.endswith('.whl') and dashed_vs in x: + # remove .pth file from the wheel + full_name = os.path.join(d, x) + print('patching .pth from', full_name) + with InMemoryZipFile(full_name) as imz: + imz.delete_from_zip_file(nsp.full_package_name + '.*.pth') + break return for x in ['-c', 'egg_info', '--egg-base', 'pip-egg-info']: if x not in sys.argv: @@ -1002,6 +1027,7 @@ def main(): if x.endswith('.whl'): # remove .pth file from the wheel full_name = os.path.join(d, x) + print('patching .pth from', full_name) with InMemoryZipFile(full_name) as imz: imz.delete_from_zip_file(nsp.full_package_name + '.*.pth') break |