From 7e31d874e54d42c09f2192fe82814e11d17012db Mon Sep 17 00:00:00 2001 From: Anthon van der Neut Date: Thu, 25 Jul 2019 16:11:18 +0200 Subject: patch latest .whl --- setup.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index 8c18ae2..644f916 100644 --- a/setup.py +++ b/setup.py @@ -1027,15 +1027,21 @@ def main(): d = os.path.join(dist_base, nsp.full_package_name) else: d = 'dist' + dashed_vs = '-' + version_str + '-' + latest_mtime = -1 + full_name = None 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 + fn = os.path.join(d, x) + if os.path.getmtime(fn) > latest_mtime: + full_name = fn + if full_name is None: + print('no wheel file found in', d) + else: + print('patching .pth from {}'.format(full_name)) + with InMemoryZipFile(full_name) as imz: + imz.delete_from_zip_file(nsp.full_package_name + '.*.pth') return for x in ['-c', 'egg_info', '--egg-base', 'pip-egg-info']: if x not in sys.argv: -- cgit