diff options
Diffstat (limited to 'scripts/dev/build_release.py')
-rwxr-xr-x | scripts/dev/build_release.py | 74 |
1 files changed, 27 insertions, 47 deletions
diff --git a/scripts/dev/build_release.py b/scripts/dev/build_release.py index ed653316b..c0482f414 100755 --- a/scripts/dev/build_release.py +++ b/scripts/dev/build_release.py @@ -20,7 +20,8 @@ import platform import collections import dataclasses import re -from typing import Iterable, List, Optional +from typing import Optional +from collections.abc import Iterable try: import winreg @@ -125,7 +126,7 @@ def _smoke_test_run( return subprocess.run(argv, check=True, capture_output=True) -def smoke_test(executable: pathlib.Path, debug: bool, qt5: bool) -> None: +def smoke_test(executable: pathlib.Path, debug: bool) -> None: """Try starting the given qutebrowser executable.""" stdout_whitelist = [] stderr_whitelist = [ @@ -164,18 +165,15 @@ def smoke_test(executable: pathlib.Path, debug: bool, qt5: bool) -> None: (r'\[.*:ERROR:command_buffer_proxy_impl.cc\([0-9]*\)\] ' r'ContextResult::kTransientFailure: Failed to send ' r'.*CreateCommandBuffer\.'), + # FIXME:qt6 Qt 6.3 on macOS + r'[0-9:]* WARNING: Incompatible version of OpenSSL', + r'[0-9:]* WARNING: Qt WebEngine resources not found at .*', + (r'[0-9:]* WARNING: Installed Qt WebEngine locales directory not found at ' + r'location /qtwebengine_locales\. Trying application directory\.\.\.'), + # Qt 6.7, only seen on macos for some reason + (r'.*Path override failed for key base::DIR_APP_DICTIONARIES ' + r"and path '.*/qtwebengine_dictionaries'"), ]) - if not qt5: - stderr_whitelist.extend([ - # FIXME:qt6 Qt 6.3 on macOS - r'[0-9:]* WARNING: Incompatible version of OpenSSL', - r'[0-9:]* WARNING: Qt WebEngine resources not found at .*', - (r'[0-9:]* WARNING: Installed Qt WebEngine locales directory not found at ' - r'location /qtwebengine_locales\. Trying application directory\.\.\.'), - # Qt 6.7, only seen on macos for some reason - (r'.*Path override failed for key base::DIR_APP_DICTIONARIES ' - r"and path '.*/qtwebengine_dictionaries'"), - ]) elif IS_WINDOWS: stderr_whitelist.extend([ # Windows N: @@ -267,10 +265,9 @@ def _mac_bin_path(base: pathlib.Path) -> pathlib.Path: def build_mac( *, gh_token: Optional[str], - qt5: bool, skip_packaging: bool, debug: bool, -) -> List[Artifact]: +) -> list[Artifact]: """Build macOS .dmg/.app.""" utils.print_title("Cleaning up...") for f in ['wc.dmg', 'template.dmg']: @@ -282,18 +279,18 @@ def build_mac( shutil.rmtree(d, ignore_errors=True) utils.print_title("Updating 3rdparty content") - update_3rdparty.run(ace=False, pdfjs=True, legacy_pdfjs=qt5, fancy_dmg=False, + update_3rdparty.run(ace=False, pdfjs=True, legacy_pdfjs=False, fancy_dmg=False, gh_token=gh_token) utils.print_title("Building .app via pyinstaller") - call_tox(f'pyinstaller{"-qt5" if qt5 else ""}', '-r', debug=debug) + call_tox('pyinstaller', '-r', debug=debug) utils.print_title("Verifying .app") verify_mac_app() dist_path = pathlib.Path("dist") utils.print_title("Running pre-dmg smoke test") - smoke_test(_mac_bin_path(dist_path), debug=debug, qt5=qt5) + smoke_test(_mac_bin_path(dist_path), debug=debug) if skip_packaging: return [] @@ -304,7 +301,6 @@ def build_mac( arch = platform.machine() suffix = "-debug" if debug else "" - suffix += "-qt5" if qt5 else "" suffix += f"-{arch}" dmg_path = dist_path / f'qutebrowser-{qutebrowser.__version__}{suffix}.dmg' pathlib.Path('qutebrowser.dmg').rename(dmg_path) @@ -317,7 +313,7 @@ def build_mac( subprocess.run(['hdiutil', 'attach', dmg_path, '-mountpoint', tmp_path], check=True) try: - smoke_test(_mac_bin_path(tmp_path), debug=debug, qt5=qt5) + smoke_test(_mac_bin_path(tmp_path), debug=debug) finally: print("Waiting 10s for dmg to be detachable...") time.sleep(10) @@ -355,10 +351,9 @@ def _get_windows_python_path() -> pathlib.Path: def _build_windows_single( *, - qt5: bool, skip_packaging: bool, debug: bool, -) -> List[Artifact]: +) -> list[Artifact]: """Build on Windows for a single build type.""" utils.print_title("Running pyinstaller") dist_path = pathlib.Path("dist") @@ -367,9 +362,7 @@ def _build_windows_single( _maybe_remove(out_path) python = _get_windows_python_path() - # FIXME:qt6 does this regress 391623d5ec983ecfc4512c7305c4b7a293ac3872? - suffix = "-qt5" if qt5 else "" - call_tox(f'pyinstaller{suffix}', '-r', python=python, debug=debug) + call_tox('pyinstaller', '-r', python=python, debug=debug) out_pyinstaller = dist_path / "qutebrowser" shutil.move(out_pyinstaller, out_path) @@ -379,7 +372,7 @@ def _build_windows_single( verify_windows_exe(exe_path) utils.print_title("Running smoke test") - smoke_test(exe_path, debug=debug, qt5=qt5) + smoke_test(exe_path, debug=debug) if skip_packaging: return [] @@ -388,19 +381,17 @@ def _build_windows_single( return _package_windows_single( out_path=out_path, debug=debug, - qt5=qt5, ) def build_windows( *, gh_token: str, skip_packaging: bool, - qt5: bool, debug: bool, -) -> List[Artifact]: +) -> list[Artifact]: """Build windows executables/setups.""" utils.print_title("Updating 3rdparty content") - update_3rdparty.run(nsis=True, ace=False, pdfjs=True, legacy_pdfjs=qt5, + update_3rdparty.run(nsis=True, ace=False, pdfjs=True, legacy_pdfjs=False, fancy_dmg=False, gh_token=gh_token) utils.print_title("Building Windows binaries") @@ -412,7 +403,6 @@ def build_windows( artifacts = _build_windows_single( skip_packaging=skip_packaging, debug=debug, - qt5=qt5, ) return artifacts @@ -421,8 +411,7 @@ def _package_windows_single( *, out_path: pathlib.Path, debug: bool, - qt5: bool, -) -> List[Artifact]: +) -> list[Artifact]: """Build the given installer/zip for windows.""" artifacts = [] @@ -430,7 +419,6 @@ def _package_windows_single( utils.print_subtitle("Building installer...") subprocess.run(['makensis.exe', f'/DVERSION={qutebrowser.__version__}', - f'/DQT5={qt5}', 'misc/nsis/qutebrowser.nsi'], check=True) name_parts = [ @@ -439,8 +427,6 @@ def _package_windows_single( ] if debug: name_parts.append('debug') - if qt5: - name_parts.append('qt5') name_parts.append('amd64') # FIXME:qt6 temporary until new installer name = '-'.join(name_parts) + '.exe' @@ -460,8 +446,6 @@ def _package_windows_single( ] if debug: zip_name_parts.append('debug') - if qt5: - zip_name_parts.append('qt5') zip_name = '-'.join(zip_name_parts) + '.zip' zip_path = dist_path / zip_name @@ -475,7 +459,7 @@ def _package_windows_single( return artifacts -def build_sdist() -> List[Artifact]: +def build_sdist() -> list[Artifact]: """Build an sdist and list the contents.""" utils.print_title("Building sdist") @@ -565,7 +549,7 @@ def read_github_token( def github_upload( - artifacts: List[Artifact], + artifacts: list[Artifact], tag: str, gh_token: str, experimental: bool, @@ -643,7 +627,7 @@ def github_upload( break -def pypi_upload(artifacts: List[Artifact], experimental: bool) -> None: +def pypi_upload(artifacts: list[Artifact], experimental: bool) -> None: """Upload the given artifacts to PyPI using twine.""" # https://blog.pypi.org/posts/2023-05-23-removing-pgp/ artifacts = [a for a in artifacts if a.mimetype != 'application/pgp-signature'] @@ -655,13 +639,13 @@ def pypi_upload(artifacts: List[Artifact], experimental: bool) -> None: run_twine('upload', artifacts) -def twine_check(artifacts: List[Artifact]) -> None: +def twine_check(artifacts: list[Artifact]) -> None: """Check packages using 'twine check'.""" utils.print_title("Running twine check...") run_twine('check', artifacts, '--strict') -def run_twine(command: str, artifacts: List[Artifact], *args: str) -> None: +def run_twine(command: str, artifacts: list[Artifact], *args: str) -> None: paths = [a.path for a in artifacts] subprocess.run([sys.executable, '-m', 'twine', command, *args, *paths], check=True) @@ -680,8 +664,6 @@ def main() -> None: help="Skip Windows installer/zip generation or macOS DMG.") parser.add_argument('--debug', action='store_true', required=False, help="Build a debug build.") - parser.add_argument('--qt5', action='store_true', required=False, - help="Build against PyQt5") parser.add_argument('--experimental', action='store_true', required=False, default=os.environ.get("GITHUB_REPOSITORY") == "qutebrowser/experiments", help="Upload to experiments repo and test PyPI. Set automatically if on qutebrowser/experiments CI.") @@ -712,14 +694,12 @@ def main() -> None: artifacts = build_windows( gh_token=gh_token, skip_packaging=args.skip_packaging, - qt5=args.qt5, debug=args.debug, ) elif IS_MACOS: artifacts = build_mac( gh_token=gh_token, skip_packaging=args.skip_packaging, - qt5=args.qt5, debug=args.debug, ) else: |