summaryrefslogtreecommitdiffstats
path: root/packaging
diff options
context:
space:
mode:
authorCalum Lind <calumlind+deluge@gmail.com>2017-06-27 17:29:11 +0100
committerCalum Lind <calumlind+deluge@gmail.com>2017-06-27 18:12:51 +0100
commit51bde704b5002a23119d19e5f9596ae2e73c477c (patch)
treed6bdb7cfb5df85252a8d9aa29ca1512a8aa87dd0 /packaging
parent3f13c24362dcdfb0133f312016a80dda964b0ad9 (diff)
downloaddeluge-51bde704b5002a23119d19e5f9596ae2e73c477c.tar.gz
deluge-51bde704b5002a23119d19e5f9596ae2e73c477c.tar.bz2
deluge-51bde704b5002a23119d19e5f9596ae2e73c477c.zip
[Packaging] Simplify release script using sdist
* setup.py sdist now creates a pristine tar which can be used for release. * Uses the version currently checked-out in git. * Removed unneeded lines in manifest.
Diffstat (limited to 'packaging')
-rwxr-xr-xpackaging/source/make_release.py76
1 files changed, 25 insertions, 51 deletions
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)