summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <git@the-compiler.org>2016-01-05 06:49:43 +0100
committerFlorian Bruhin <git@the-compiler.org>2016-01-05 06:54:37 +0100
commit8ab0b5b4ac10e309dee7ec4e74bad4212dc0e37d (patch)
tree19fad6c287502857989fca3b69ed514819ff5a38
parent8d63f2bf935302e133e7e632d1e110d22fd350e3 (diff)
downloadqutebrowser-8ab0b5b4ac10e309dee7ec4e74bad4212dc0e37d.tar.gz
qutebrowser-8ab0b5b4ac10e309dee7ec4e74bad4212dc0e37d.zip
Use build_release.py to build sdist on Linux.
See #1091.
-rw-r--r--CONTRIBUTING.asciidoc10
-rwxr-xr-xscripts/dev/build_release.py44
2 files changed, 45 insertions, 9 deletions
diff --git a/CONTRIBUTING.asciidoc b/CONTRIBUTING.asciidoc
index 204a5e40b..c8c70c3c2 100644
--- a/CONTRIBUTING.asciidoc
+++ b/CONTRIBUTING.asciidoc
@@ -558,13 +558,12 @@ New PyQt release
qutebrowser release
~~~~~~~~~~~~~~~~~~~
-* Make sure there are no unstaged changes.
-* Run `src2asciidoc.py` and commit changes if necessary.
+* Make sure there are no unstaged changes and the tests are green.
-* Run `asciidoc2html.py`.
* Adjust `__version_info__` in `qutebrowser/__init__.py`.
* Remove *(unreleased)* from changelog.
-* Run all tests on all supported systems.
+* Run tests again
+* Run `asciidoc2html.py`.
* Commit
* Create annotated git tag (`git tag -s "v0.X.Y" -m "Release v0.X.Y"`)
@@ -575,8 +574,7 @@ qutebrowser release
* Mark the milestone at https://github.com/The-Compiler/qutebrowser/milestones
as closed.
-* Build sdist: `python3 setup.py sdist --sign`
-* Sign: `gpg --detach-sign -a dist/qutebrowser-0.X.Y.tar.gz`
+* Run `scripts/dev/build_release.py` on Linux to build an sdist
* Upload to PyPI: `twine upload dist/foo{,.asc}`
* Create Windows packages via `scripts/dev/build_release.py` and upload.
diff --git a/scripts/dev/build_release.py b/scripts/dev/build_release.py
index fc4aee55f..ab207d422 100755
--- a/scripts/dev/build_release.py
+++ b/scripts/dev/build_release.py
@@ -27,6 +27,9 @@ import os.path
import shutil
import subprocess
import argparse
+import tarfile
+import collections
+import shutil
sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir,
os.pardir))
@@ -61,7 +64,7 @@ def call_freeze(*args, python=sys.executable):
env=env)
-def build_common(args):
+def run_asciidoc2html(args):
"""Common buildsteps used for all OS'."""
utils.print_title("Running asciidoc2html.py")
if args.asciidoc is not None:
@@ -87,6 +90,7 @@ def smoke_test(executable):
def build_windows():
"""Build windows executables/setups."""
+ utils.print_title("Building Windows binaries")
parts = str(sys.version_info.major), str(sys.version_info.minor)
ver = ''.join(parts)
dotver = '.'.join(parts)
@@ -142,6 +146,39 @@ def build_windows():
qutebrowser.__version__), 'zip', destdir)
+def build_sdist():
+ """Build an sdist and list the contents."""
+ utils.print_title("Building sdist")
+
+ shutil.rmtree('dist')
+
+ subprocess.check_call([sys.executable, 'setup.py', 'sdist'])
+ dist_files = os.listdir(os.path.abspath('dist'))
+ assert len(dist_files) == 1
+
+ dist_file = os.path.join('dist', dist_files[0])
+ subprocess.check_call(['gpg', '--detach-sign', '-a', dist_file])
+
+ tar = tarfile.open(dist_file)
+ by_ext = collections.defaultdict(list)
+
+ for tarinfo in tar.getmembers():
+ if not tarinfo.isfile():
+ continue
+ name = os.sep.join(tarinfo.name.split(os.sep)[1:])
+ _base, ext = os.path.splitext(name)
+ by_ext[ext].append(name)
+
+ assert '.pyc' not in by_ext
+
+ utils.print_title("sdist contents")
+
+ for ext, files in sorted(by_ext.items()):
+ utils.print_subtitle(ext)
+ print('\n'.join(files))
+
+
+
def main():
"""Main entry point."""
parser = argparse.ArgumentParser()
@@ -151,6 +188,7 @@ def main():
metavar=('PYTHON', 'ASCIIDOC'))
args = parser.parse_args()
utils.change_cwd()
+
if os.name == 'nt':
if sys.maxsize > 2**32:
# WORKAROUND
@@ -160,10 +198,10 @@ def main():
print("See http://bugs.python.org/issue24493 and ")
print("https://github.com/pypa/virtualenv/issues/774")
sys.exit(1)
- build_common(args)
+ run_asciidoc2html(args)
build_windows()
else:
- print("This script does nothing except on Windows currently.")
+ build_sdist()
if __name__ == '__main__':