From c319ce1e84b65fe517be5d282de9d87dcaa1c56d Mon Sep 17 00:00:00 2001 From: Laurent Bachelier Date: Mon, 24 Dec 2018 18:11:12 +0100 Subject: [PATCH] release: Build universal wheel archive --- release.py | 33 ++++++++++++++++++++++----------- setup.cfg | 5 +++++ 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/release.py b/release.py index 576dd31ed4..4673b1c8a0 100755 --- a/release.py +++ b/release.py @@ -9,7 +9,8 @@ WORKTREE = 'release_tmp' OPTIONS = ['--qt', '--xdg'] -def make_tarball(tag): + +def make_tarball(tag, wheel): # Create and enter a temporary worktree if os.path.isdir(WORKTREE): check_call(['git', 'worktree', 'remove', '--force', WORKTREE]) @@ -17,21 +18,30 @@ def make_tarball(tag): assert os.path.isdir(WORKTREE) os.chdir(WORKTREE) - check_call([sys.executable, 'setup.py'] + OPTIONS + ['sdist', - '--keep', - '--dist-dir', '../dist']) + check_call([sys.executable, 'setup.py'] + OPTIONS + + ['sdist', + '--keep', + '--dist-dir', '../dist']) + if wheel: + check_call([sys.executable, 'setup.py'] + OPTIONS + + ['bdist_wheel', + '--keep', + '--dist-dir', '../dist']) # Clean up the temporary worktree os.chdir(os.pardir) check_call(['git', 'worktree', 'remove', '--force', WORKTREE]) assert not os.path.isdir(WORKTREE) - tarball = 'dist/weboob-%s.tar.gz' % tag - if os.path.exists(tarball): - print('Generated tarball: %s' % tarball) - print('To upload to PyPI, run: twine upload -s %s' % tarball) - else: - raise Exception('Generated tarball not found at %s' % tarball) + files = ['dist/weboob-%s.tar.gz' % tag] + if wheel: + files.append('dist/weboob-%s-py2.py3-none-any.whl' % tag) + for f in files: + if not os.path.exists(f): + raise Exception('Generated file not found at %s' % f) + else: + print('Generated file: %s' % f) + print('To upload to PyPI, run: twine upload -s %s' % ' '.join(files)) if __name__ == '__main__': @@ -40,8 +50,9 @@ def make_tarball(tag): tarball_parser = subparsers.add_parser('tarball') tarball_parser.add_argument('tag') + tarball_parser.add_argument('--no-wheel', action='store_false', dest='wheel') tarball_parser.set_defaults(mode='tarball') args = parser.parse_args() if args.mode == 'tarball': - make_tarball(args.tag) + make_tarball(args.tag, args.wheel) diff --git a/setup.cfg b/setup.cfg index 1302f2f429..9282344b88 100644 --- a/setup.cfg +++ b/setup.cfg @@ -36,3 +36,8 @@ group = root [bdist] owner = root group = root + +[bdist_wheel] +owner = root +group = root +universal = 1 -- GitLab