Commit c319ce1e authored by Laurent Bachelier's avatar Laurent Bachelier 🐧 Committed by Romain Bignon

release: Build universal wheel archive

parent a469c93d
......@@ -9,7 +9,8 @@ from subprocess import check_call
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 @@ if __name__ == '__main__':
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)
......@@ -36,3 +36,8 @@ group = root
[bdist]
owner = root
group = root
[bdist_wheel]
owner = root
group = root
universal = 1
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment