diff options
Diffstat (limited to 'scripts/dev')
-rwxr-xr-x | scripts/dev/build_release.py | 46 | ||||
-rw-r--r-- | scripts/dev/recompile_requirements.py | 11 |
2 files changed, 39 insertions, 18 deletions
diff --git a/scripts/dev/build_release.py b/scripts/dev/build_release.py index 2b3aff4b4..5463441be 100755 --- a/scripts/dev/build_release.py +++ b/scripts/dev/build_release.py @@ -26,6 +26,7 @@ import os.path import sys import time import shutil +import pathlib import plistlib import subprocess import argparse @@ -480,14 +481,17 @@ def build_sdist(): """Build an sdist and list the contents.""" utils.print_title("Building sdist") - _maybe_remove('dist') + dist_path = pathlib.Path('dist') + _maybe_remove(dist_path) - subprocess.run([sys.executable, 'setup.py', 'sdist'], check=True) - dist_files = os.listdir(os.path.abspath('dist')) - assert len(dist_files) == 1 + subprocess.run([sys.executable, '-m', 'build'], check=True) - dist_file = os.path.join('dist', dist_files[0]) - subprocess.run(['gpg', '--detach-sign', '-a', dist_file], check=True) + dist_files = list(dist_path.glob('*.tar.gz')) + filename = 'qutebrowser-{}.tar.gz'.format(qutebrowser.__version__) + assert dist_files == [dist_path / filename], dist_files + dist_file = dist_files[0] + + subprocess.run(['gpg', '--detach-sign', '-a', str(dist_file)], check=True) by_ext = collections.defaultdict(list) @@ -507,11 +511,13 @@ def build_sdist(): utils.print_subtitle(ext) print('\n'.join(files)) - filename = 'qutebrowser-{}.tar.gz'.format(qutebrowser.__version__) artifacts = [ - (os.path.join('dist', filename), 'application/gzip', 'Source release'), - (os.path.join('dist', filename + '.asc'), 'application/pgp-signature', - 'Source release - PGP signature'), + (str(dist_file), 'application/gzip', 'Source release'), + ( + str(dist_file.with_suffix(dist_file.suffix + '.asc')), + 'application/pgp-signature', + 'Source release - PGP signature', + ), ] return artifacts @@ -600,15 +606,19 @@ def github_upload(artifacts, tag, gh_token): def pypi_upload(artifacts): """Upload the given artifacts to PyPI using twine.""" utils.print_title("Uploading to PyPI...") - filenames = [a[0] for a in artifacts] - subprocess.run([sys.executable, '-m', 'twine', 'upload'] + filenames, - check=True) + run_twine('upload', artifacts) -def upgrade_sdist_dependencies(): - """Make sure we have the latest tools for an sdist release.""" - subprocess.run([sys.executable, '-m', 'pip', 'install', '-U', 'twine', - 'pip', 'wheel', 'setuptools'], check=True) +def twine_check(artifacts): + """Check packages using 'twine check'.""" + utils.print_title("Running twine check...") + run_twine('check', artifacts, '--strict') + + +def run_twine(command, artifacts, *args): + filenames = [a[0] for a in artifacts] + subprocess.run([sys.executable, '-m', 'twine', command] + list(args) + filenames, + check=True) def main(): @@ -668,9 +678,9 @@ def main(): elif sys.platform == 'darwin': artifacts = build_mac(gh_token=gh_token, debug=args.debug) else: - upgrade_sdist_dependencies() test_makefile() artifacts = build_sdist() + twine_check(artifacts) upload_to_pypi = True if args.upload: diff --git a/scripts/dev/recompile_requirements.py b/scripts/dev/recompile_requirements.py index f052fe638..89b0fe515 100644 --- a/scripts/dev/recompile_requirements.py +++ b/scripts/dev/recompile_requirements.py @@ -188,6 +188,17 @@ CHANGELOG_URLS = { 'future': 'https://python-future.org/whatsnew.html', 'pefile': 'https://github.com/erocarrera/pefile/commits/master', 'Deprecated': 'https://github.com/tantale/deprecated/blob/master/CHANGELOG.rst', + 'SecretStorage': 'https://github.com/mitya57/secretstorage/blob/master/changelog', + 'bleach': 'https://github.com/mozilla/bleach/blob/main/CHANGES', + 'jeepney': 'https://gitlab.com/takluyver/jeepney/-/blob/master/docs/release-notes.rst', + 'keyring': 'https://github.com/jaraco/keyring/blob/main/CHANGES.rst', + 'pkginfo': 'https://bazaar.launchpad.net/~tseaver/pkginfo/trunk/view/head:/CHANGES.txt', + 'readme-renderer': 'https://github.com/pypa/readme_renderer/blob/main/CHANGES.rst', + 'requests-toolbelt': 'https://github.com/requests/toolbelt/blob/master/HISTORY.rst', + 'rfc3986': 'https://rfc3986.readthedocs.io/en/latest/release-notes/index.html', + 'tqdm': 'https://tqdm.github.io/releases/', + 'twine': 'https://twine.readthedocs.io/en/stable/changelog.html', + 'webencodings': 'https://github.com/gsnedders/python-webencodings/commits/master', } |