diff options
-rw-r--r-- | MANIFEST.in | 2 | ||||
-rwxr-xr-x | packaging/source/make_release.py | 76 |
2 files changed, 25 insertions, 53 deletions
diff --git a/MANIFEST.in b/MANIFEST.in index 5e240254f..3ef10fbed 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,11 +1,9 @@ include AUTHORS ChangeLog DEPENDS LICENSE RELEASE-VERSION README.rst include msgfmt.py minify_web_js.py version.py gen_web_gettext.py -exclude .* tox.ini graft docs/man include deluge/i18n/*.po -recursive-exclude deluge/i18n LC_MESSAGES *.mo graft deluge/plugins recursive-exclude deluge/plugins create_dev_link.sh *.pyc *.egg diff --git a/packaging/source/make_release.py b/packaging/source/make_release.py index 2b83b0fb5..62806f04e 100755 --- a/packaging/source/make_release.py +++ b/packaging/source/make_release.py @@ -7,17 +7,11 @@ # the additional special exception to link portions of this program with the OpenSSL library. # See LICENSE for more details. # +from __future__ import print_function, unicode_literals -import contextlib -import os -import sys -import tarfile +import os.path from hashlib import sha256 -from subprocess import STDOUT, CalledProcessError, call, check_output - - -sys.path.append('.') -from version import get_version # NOQA, isort: skip, +from subprocess import call, check_output try: import lzma @@ -25,54 +19,34 @@ except ImportError: try: from backports import lzma except ImportError: - print('backports.lzma not installed, falling back to `tar`') + print('backports.lzma not installed, falling back to xz shell command') lzma = None +# Compress WebUI javascript and gettext.js +call(['python', 'minify_web_js.py']) +call(['python', 'gen_web_gettext.py']) -"""Get latest annotated tag""" -try: - release_tag = check_output('git describe --exact-match --abbrev=0'.split(), stderr=STDOUT) -except CalledProcessError: - # Fallback to dev build tag. - dev_tag = check_output('git describe --tags'.split()).strip() - release_tag = dev_tag - -version = release_tag.split('deluge-')[1] -version_alt = get_version(prefix='deluge-', suffix='.dev0') -release_dir = 'release' -source_dir = os.path.join(release_dir, release_tag) - -# TODO: tag found/not found continue? (add option to specify tag) - -# TODO: Verify version and date changed in Changelog? -# if check_output(('git grep -l "%s" | grep -v ChangeLog' % version).split()): -# sys.exit(1) - -"""Create release archive""" -try: - os.mkdir(release_dir) -except OSError: - pass - -print('Creating release archive for ' + release_tag) -call('git archive --format=tar --prefix={tag}/ {tag} | tar -x -C {_dir}'.format( - tag=release_tag, _dir=release_dir), shell=True) +version = check_output(['python', 'version.py']).strip() -"""Compress WebUI javascript""" -call(['python', 'minify_web_js.py']) +# Create release archive +release_dir = 'dist/release-%s' % version +print('Creating release archive for ' + version) +call('python setup.py --quiet egg_info --egg-base /tmp sdist --formats=tar --dist-dir=%s' % release_dir, shell=True) -"""Create source release tarball.""" -tarball = release_tag + '.tar.xz' -tarball_path = os.path.join(release_dir, tarball) +# Compress release archive with xz +tar_path = os.path.join(release_dir, 'deluge-%s.tar' % version) +tarxz_path = tar_path + '.xz' +print('Compressing tar (%s) with xz' % tar_path) if lzma: - with contextlib.closing(lzma.LZMAFile(tarball_path, mode='w')) as xz_file: - with tarfile.open(fileobj=xz_file, mode='w') as _file: - _file.add(source_dir, arcname=release_tag) + with open(tar_path, 'rb') as tar_file, open(tarxz_path, 'wb') as xz_file: + xz_file.write(lzma.compress(bytes(tar_file.read()), preset=9 | lzma.PRESET_EXTREME)) else: - call(['tar', '-cJf', tarball_path, '-C', release_dir, release_tag]) + call(['xz', '-e9zkf', tar_path]) -"""Calculate shasum and add to SHASUMS256.txt""" -with open(tarball_path, 'rb') as _file: - sha256sum = '%s %s' % (sha256(_file.read()).hexdigest(), tarball) -with open(os.path.join(release_dir, 'SHASUMS256.txt'), 'w') as _file: +# Calculate shasum and add to sha256sums.txt +with open(tarxz_path, 'rb') as _file: + sha256sum = '%s %s' % (sha256(_file.read()).hexdigest(), os.path.basename(tarxz_path)) +with open(os.path.join(release_dir, 'sha256sums.txt'), 'w') as _file: _file.write(sha256sum + '\n') + +print('Complete: %s' % release_dir) |