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

release: Use setuptools to make the tarball

parent d7ddbaa8
#!/usr/bin/python
from __future__ import print_function
import argparse
import os
import sys
from subprocess import check_call
WORKTREE = 'release_tmp'
OPTIONS = ['--qt', '--xdg']
def make_tarball(tag):
# Create and enter a temporary worktree
if os.path.isdir(WORKTREE):
check_call(['git', 'worktree', 'remove', '--force', WORKTREE])
check_call(['git', 'worktree', 'add', WORKTREE, tag])
assert os.path.isdir(WORKTREE)
os.chdir(WORKTREE)
check_call([sys.executable, 'setup.py'] + OPTIONS + ['sdist',
'--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)
if __name__ == '__main__':
parser = argparse.ArgumentParser()
subparsers = parser.add_subparsers()
tarball_parser = subparsers.add_parser('tarball')
tarball_parser.add_argument('tag')
tarball_parser.set_defaults(mode='tarball')
args = parser.parse_args()
if args.mode == 'tarball':
make_tarball(args.tag)
......@@ -49,10 +49,7 @@ echo "Release tag:"
git tag $VERSION -s -m "Weboob $VERSION"
echo -ne "\n"
echo -n "Generating archive.. "
git archive HEAD --prefix=weboob-$VERSION/ -o weboob-$VERSION.tar
gzip -f weboob-$VERSION.tar
md5sum weboob-$VERSION.tar.gz
python release.py tarball $VERSION
echo -ne "\nDo you want to change the version number (y/n) "
read change_version
......
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