| 1 |
# SPDX-License-Identifier: BSD-2-Clause |
| 2 |
|
| 3 |
# Copyright (c) 2024 Phil Thompson <[email protected]> |
| 4 |
|
| 5 |
|
| 6 |
from argparse import ArgumentParser |
| 7 |
import sys |
| 8 |
|
| 9 |
from sipbuild import handle_exception |
| 10 |
|
| 11 |
from ..version import PYQTBUILD_VERSION_STR |
| 12 |
|
| 13 |
from .bundle import bundle |
| 14 |
from .verbose import set_verbose |
| 15 |
|
| 16 |
|
| 17 |
def main(): |
| 18 |
""" Bundle Qt with a wheel. """ |
| 19 |
|
| 20 |
# Parse the command line. |
| 21 |
parser = ArgumentParser( |
| 22 |
description="Bundle a Qt installation with a PyQt wheel.") |
| 23 |
|
| 24 |
parser.add_argument('-V', '--version', action='version', |
| 25 |
version=PYQTBUILD_VERSION_STR) |
| 26 |
|
| 27 |
parser.add_argument('--verbose', default=False, action='store_true', |
| 28 |
help="enable verbose progress messages") |
| 29 |
|
| 30 |
if sys.platform == 'darwin': |
| 31 |
parser.add_argument('--arch', choices=('x86_64', 'arm64'), |
| 32 |
help="the architecture to bundle") |
| 33 |
|
| 34 |
parser.add_argument('--build-tag-suffix', metavar='SUFFIX', |
| 35 |
help="append SUFFIX to the build tag in the wheel name") |
| 36 |
|
| 37 |
parser.add_argument('--exclude', metavar="NAME", default=[], |
| 38 |
action='append', help="exclude the NAME bindings from the wheel") |
| 39 |
|
| 40 |
parser.add_argument('--ignore-missing', default=False, action='store_true', |
| 41 |
help="ignore any missing files in the Qt installation") |
| 42 |
|
| 43 |
parser.add_argument('--no-msvc-runtime', dest='msvc_runtime', default=True, |
| 44 |
action='store_false', |
| 45 |
help="don't include msvcp140.dll, concrt140.dll and " |
| 46 |
"vcruntime140.dll in the wheel") |
| 47 |
|
| 48 |
parser.add_argument('--no-openssl', dest='openssl', default=True, |
| 49 |
action='store_false', |
| 50 |
help="don't include the OpenSSL DLLs in the wheel") |
| 51 |
|
| 52 |
parser.add_argument('--openssl-dir', metavar='DIR', |
| 53 |
help="replace the OpenSSL DLLs with the versions in DIR") |
| 54 |
|
| 55 |
parser.add_argument('--qt-dir', metavar='DIR', required=True, |
| 56 |
help="the Qt installation in DIR to be bundled with the wheel") |
| 57 |
|
| 58 |
parser.add_argument(dest='wheels', nargs=1, help="the wheel to update", |
| 59 |
metavar="wheel") |
| 60 |
|
| 61 |
args = parser.parse_args() |
| 62 |
|
| 63 |
try: |
| 64 |
set_verbose(args.verbose) |
| 65 |
|
| 66 |
try: |
| 67 |
arch = args.arch |
| 68 |
except AttributeError: |
| 69 |
arch = None |
| 70 |
|
| 71 |
bundle(wheel_path=args.wheels[0], qt_dir=args.qt_dir, |
| 72 |
build_tag_suffix=args.build_tag_suffix, |
| 73 |
msvc_runtime=args.msvc_runtime, openssl=args.openssl, |
| 74 |
openssl_dir=args.openssl_dir, exclude=args.exclude, |
| 75 |
ignore_missing=args.ignore_missing, arch=arch) |
| 76 |
except Exception as e: |
| 77 |
handle_exception(e) |
| 78 |
|
| 79 |
return 0 |