The new woob repository is here: https://gitlab.com/woob/woob. This gitlab will be removed soon.

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 @@ ...@@ -9,7 +9,8 @@
WORKTREE = 'release_tmp' WORKTREE = 'release_tmp'
OPTIONS = ['--qt', '--xdg'] OPTIONS = ['--qt', '--xdg']
def make_tarball(tag):
def make_tarball(tag, wheel):
# Create and enter a temporary worktree # Create and enter a temporary worktree
if os.path.isdir(WORKTREE): if os.path.isdir(WORKTREE):
check_call(['git', 'worktree', 'remove', '--force', WORKTREE]) check_call(['git', 'worktree', 'remove', '--force', WORKTREE])
...@@ -17,21 +18,30 @@ def make_tarball(tag): ...@@ -17,21 +18,30 @@ def make_tarball(tag):
assert os.path.isdir(WORKTREE) assert os.path.isdir(WORKTREE)
os.chdir(WORKTREE) os.chdir(WORKTREE)
check_call([sys.executable, 'setup.py'] + OPTIONS + ['sdist', check_call([sys.executable, 'setup.py'] + OPTIONS +
'--keep', ['sdist',
'--dist-dir', '../dist']) '--keep',
'--dist-dir', '../dist'])
if wheel:
check_call([sys.executable, 'setup.py'] + OPTIONS +
['bdist_wheel',
'--keep',
'--dist-dir', '../dist'])
# Clean up the temporary worktree # Clean up the temporary worktree
os.chdir(os.pardir) os.chdir(os.pardir)
check_call(['git', 'worktree', 'remove', '--force', WORKTREE]) check_call(['git', 'worktree', 'remove', '--force', WORKTREE])
assert not os.path.isdir(WORKTREE) assert not os.path.isdir(WORKTREE)
tarball = 'dist/weboob-%s.tar.gz' % tag files = ['dist/weboob-%s.tar.gz' % tag]
if os.path.exists(tarball): if wheel:
print('Generated tarball: %s' % tarball) files.append('dist/weboob-%s-py2.py3-none-any.whl' % tag)
print('To upload to PyPI, run: twine upload -s %s' % tarball) for f in files:
else: if not os.path.exists(f):
raise Exception('Generated tarball not found at %s' % tarball) 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__': if __name__ == '__main__':
...@@ -40,8 +50,9 @@ def make_tarball(tag): ...@@ -40,8 +50,9 @@ def make_tarball(tag):
tarball_parser = subparsers.add_parser('tarball') tarball_parser = subparsers.add_parser('tarball')
tarball_parser.add_argument('tag') tarball_parser.add_argument('tag')
tarball_parser.add_argument('--no-wheel', action='store_false', dest='wheel')
tarball_parser.set_defaults(mode='tarball') tarball_parser.set_defaults(mode='tarball')
args = parser.parse_args() args = parser.parse_args()
if args.mode == 'tarball': if args.mode == 'tarball':
make_tarball(args.tag) make_tarball(args.tag, args.wheel)
...@@ -36,3 +36,8 @@ group = root ...@@ -36,3 +36,8 @@ group = root
[bdist] [bdist]
owner = root owner = root
group = 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