mirror of
https://github.com/miurahr/aqtinstall.git
synced 2025-12-17 20:54:38 +03:00
Add --use-official-installer to install-qt
This commit is contained in:
@@ -368,6 +368,69 @@ class Cli:
|
|||||||
else:
|
else:
|
||||||
qt_version = args.qt_version
|
qt_version = args.qt_version
|
||||||
Cli._validate_version_str(qt_version)
|
Cli._validate_version_str(qt_version)
|
||||||
|
|
||||||
|
if hasattr(args, "use_official_installer") and args.use_official_installer is not None:
|
||||||
|
|
||||||
|
if len(args.use_official_installer) not in [0, 2]:
|
||||||
|
raise CliInputError(
|
||||||
|
"When providing arguments to --use-official-installer, exactly 2 arguments are required: "
|
||||||
|
"--use-official-installer email password"
|
||||||
|
)
|
||||||
|
|
||||||
|
self.logger.info("Using official Qt installer")
|
||||||
|
|
||||||
|
commercial_args = InstallArgParser()
|
||||||
|
|
||||||
|
# Core parameters required by install-qt-official
|
||||||
|
commercial_args.target = args.target
|
||||||
|
commercial_args.arch = self._set_arch(
|
||||||
|
args.arch, args.host, args.target, getattr(args, "qt_version", getattr(args, "qt_version_spec", ""))
|
||||||
|
)
|
||||||
|
|
||||||
|
commercial_args.version = qt_version
|
||||||
|
|
||||||
|
email = None
|
||||||
|
password = None
|
||||||
|
if len(args.use_official_installer) == 2:
|
||||||
|
email, password = args.use_official_installer
|
||||||
|
self.logger.info(f"Using credentials provided with --use-official-installer")
|
||||||
|
|
||||||
|
# Optional parameters
|
||||||
|
commercial_args.email = email or getattr(args, "email", None)
|
||||||
|
commercial_args.pw = password or getattr(args, "pw", None)
|
||||||
|
commercial_args.outputdir = args.outputdir
|
||||||
|
commercial_args.modules = args.modules
|
||||||
|
commercial_args.base = getattr(args, "base", None)
|
||||||
|
|
||||||
|
# TODO Add those, and remove from ignored
|
||||||
|
commercial_args.override = None
|
||||||
|
commercial_args.dry_run = None
|
||||||
|
|
||||||
|
# Log ignored options
|
||||||
|
ignored_options = []
|
||||||
|
if getattr(args, "noarchives", False):
|
||||||
|
ignored_options.append("--noarchives")
|
||||||
|
if getattr(args, "autodesktop", False):
|
||||||
|
ignored_options.append("--autodesktop")
|
||||||
|
if getattr(args, "archives", None):
|
||||||
|
ignored_options.append("--archives")
|
||||||
|
if getattr(args, "timeout", False):
|
||||||
|
ignored_options.append("--timeout")
|
||||||
|
if getattr(args, "keep", False):
|
||||||
|
ignored_options.append("--keep")
|
||||||
|
if getattr(args, "archive_dest", False):
|
||||||
|
ignored_options.append("--archive_dest")
|
||||||
|
if getattr(args, "dry_run", False):
|
||||||
|
ignored_options.append("--dry_run")
|
||||||
|
if getattr(args, "override", False):
|
||||||
|
ignored_options.append("--override")
|
||||||
|
|
||||||
|
if ignored_options:
|
||||||
|
self.logger.warning("Options ignored because you requested the official installer:")
|
||||||
|
self.logger.warning(", ".join(ignored_options))
|
||||||
|
|
||||||
|
return self.run_install_qt_commercial(commercial_args, print_version=False)
|
||||||
|
|
||||||
archives = args.archives
|
archives = args.archives
|
||||||
if args.noarchives:
|
if args.noarchives:
|
||||||
if modules is None:
|
if modules is None:
|
||||||
@@ -683,8 +746,9 @@ class Cli:
|
|||||||
)
|
)
|
||||||
show_list(meta)
|
show_list(meta)
|
||||||
|
|
||||||
def run_install_qt_commercial(self, args: InstallArgParser) -> None:
|
def run_install_qt_commercial(self, args: InstallArgParser, print_version: Optional[bool] = True) -> None:
|
||||||
"""Execute commercial Qt installation"""
|
"""Execute commercial Qt installation"""
|
||||||
|
if print_version:
|
||||||
self.show_aqt_version()
|
self.show_aqt_version()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -721,7 +785,7 @@ class Cli:
|
|||||||
commercial_installer.install()
|
commercial_installer.install()
|
||||||
Settings.qt_installer_cleanup()
|
Settings.qt_installer_cleanup()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.logger.error(f"Error installing official installer {str(e)}")
|
self.logger.error(f"Error installing official installer: {str(e)}")
|
||||||
finally:
|
finally:
|
||||||
self.logger.info("Done")
|
self.logger.info("Done")
|
||||||
|
|
||||||
@@ -793,6 +857,16 @@ class Cli:
|
|||||||
"required. When enabled, this option installs the required desktop version automatically. "
|
"required. When enabled, this option installs the required desktop version automatically. "
|
||||||
"It has no effect when the desktop installation is not required.",
|
"It has no effect when the desktop installation is not required.",
|
||||||
)
|
)
|
||||||
|
install_qt_parser.add_argument(
|
||||||
|
"--use-official-installer",
|
||||||
|
nargs="*",
|
||||||
|
default=None,
|
||||||
|
metavar=("EMAIL", "PASSWORD"),
|
||||||
|
help="Use the official Qt installer for installation instead of the aqt downloader. "
|
||||||
|
"Can be used without arguments or with email and password: --use-official-installer email password. "
|
||||||
|
"This redirects to install-qt-official. "
|
||||||
|
"Arguments not compatible with the official installer will be ignored.",
|
||||||
|
)
|
||||||
|
|
||||||
def _set_install_tool_parser(self, install_tool_parser):
|
def _set_install_tool_parser(self, install_tool_parser):
|
||||||
install_tool_parser.set_defaults(func=self.run_install_tool)
|
install_tool_parser.set_defaults(func=self.run_install_tool)
|
||||||
@@ -951,7 +1025,7 @@ class Cli:
|
|||||||
def _make_all_parsers(self, subparsers: argparse._SubParsersAction) -> None:
|
def _make_all_parsers(self, subparsers: argparse._SubParsersAction) -> None:
|
||||||
"""Creates all command parsers and adds them to the subparsers"""
|
"""Creates all command parsers and adds them to the subparsers"""
|
||||||
|
|
||||||
def make_parser_it(cmd: str, desc: str, set_parser_cmd, formatter_class):
|
def make_parser_it(cmd: str, desc: str, set_parser_cmd, formatter_class) -> None:
|
||||||
kwargs = {"formatter_class": formatter_class} if formatter_class else {}
|
kwargs = {"formatter_class": formatter_class} if formatter_class else {}
|
||||||
p = subparsers.add_parser(cmd, description=desc, **kwargs)
|
p = subparsers.add_parser(cmd, description=desc, **kwargs)
|
||||||
set_parser_cmd(p)
|
set_parser_cmd(p)
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ All contributors, listed alphabetically, are:
|
|||||||
|
|
||||||
* Adrian Eddy (fix the case of Android 6.7.0)
|
* Adrian Eddy (fix the case of Android 6.7.0)
|
||||||
* Alberto Mardegan(ignore_hash option)
|
* Alberto Mardegan(ignore_hash option)
|
||||||
|
* Alexandre @Kidev Poumaroux (official installer option, WASM fixes for Qt6.7.x)
|
||||||
* Andrew Wason (support arm64)
|
* Andrew Wason (support arm64)
|
||||||
* Andrei Yankovich (tools ifw installation)
|
* Andrei Yankovich (tools ifw installation)
|
||||||
* Aurélien Gâteau (patching to qmake)
|
* Aurélien Gâteau (patching to qmake)
|
||||||
|
|||||||
@@ -44,50 +44,6 @@ Options
|
|||||||
* If none are inputed, the package ``qtX.Y.Z-essentials`` is downloaded (default Qt install, includes ``qtcreator``...)
|
* If none are inputed, the package ``qtX.Y.Z-essentials`` is downloaded (default Qt install, includes ``qtcreator``...)
|
||||||
* If ``all`` is inputed, the package ``qtX.Y.Z-full`` is downloaded (includes everything)
|
* If ``all`` is inputed, the package ``qtX.Y.Z-full`` is downloaded (includes everything)
|
||||||
|
|
||||||
.. dropdown:: Click to see all the special packages (for Linux Qt 6.8.1)
|
|
||||||
|
|
||||||
.. code-block:: text
|
|
||||||
|
|
||||||
Name: qt6.8.1-essentials
|
|
||||||
Display name: Qt 6.8.1 Linux x86_64 Essential Components
|
|
||||||
Description: Qt 6.8.1 Linux x86_64 Essential Libraries, Headers, and Tools
|
|
||||||
Version: 6.8.1
|
|
||||||
Components: qt.qt6.681.linux_gcc_64
|
|
||||||
|
|
||||||
Name: qt6.8.1-essentials-dev
|
|
||||||
Display name: Qt 6.8.1 Linux x86_64 Essential Components (dev)
|
|
||||||
Description: Qt 6.8.1 Linux x86_64 Essential Libraries, Headers, and Tools (dev)
|
|
||||||
Version: 6.8.1
|
|
||||||
Required aliases: qt6.8.1-essentials
|
|
||||||
|
|
||||||
Name: qt6.8.1-full
|
|
||||||
Display name: Qt 6.8.1 Linux x86_64 All Components with Sources
|
|
||||||
Description: Qt 6.8.1 Linux x86_64 All Libraries, Headers, Tools, and Sources
|
|
||||||
Version: 6.8.1
|
|
||||||
Components: qt.qt6.681.src,extensions.qtwebengine.681.src
|
|
||||||
Required aliases: qt6.8.1-essentials,qt6.8.1-addons,qt6.8.1-extensions
|
|
||||||
Optional components: extensions.qtinsighttracker.681.src
|
|
||||||
|
|
||||||
Name: qt6.8.1-full-dbg
|
|
||||||
Display name: Qt 6.8.1 Linux x86_64 All Components with Sources and Debug Information Files
|
|
||||||
Description: Qt 6.8.1 Linux x86_64 All Libraries, Headers, Tools, Sources, and Debug Information Files (dev)
|
|
||||||
Version: 6.8.1
|
|
||||||
Components: qt.qt6.681.debug_info.linux_gcc_64,qt.qt6.681.debug_info,extensions.qtwebengine.681.debug_information
|
|
||||||
Required aliases: qt6.8.1-full-dev
|
|
||||||
|
|
||||||
Name: qt6.8.1-full-dev
|
|
||||||
Display name: Qt 6.8.1 Linux x86_64 All Components with Sources (dev)
|
|
||||||
Description: Qt 6.8.1 Linux x86_64 All Libraries, Headers, Tools, and Sources (dev)
|
|
||||||
Version: 6.8.1
|
|
||||||
Required aliases: qt6.8.1-full
|
|
||||||
|
|
||||||
Name: qt6.8.1-sdk
|
|
||||||
Display name: Qt 6.8.1 Linux x86_64 SDK
|
|
||||||
Description: Qt 6.8.1 Linux x86_64 SDK Tools (Qt Creator, Ninja, and CMake)
|
|
||||||
Version: 6.8.1
|
|
||||||
Components: qt.tools.qtcreator_gui,qt.tools.cmake,qt.tools.ninja
|
|
||||||
Required aliases: qt6.8.1-full-dev,qt6.8.1-full-dbg
|
|
||||||
|
|
||||||
- ``--outputdir <path>`` - Installation directory (default: current directory)
|
- ``--outputdir <path>`` - Installation directory (default: current directory)
|
||||||
- ``--override <args...>`` - Pass all remaining arguments directly to the Qt installer CLI
|
- ``--override <args...>`` - Pass all remaining arguments directly to the Qt installer CLI
|
||||||
|
|
||||||
@@ -106,7 +62,7 @@ Options
|
|||||||
- ``search_terms`` - Terms to search for in package names (grabs all that is not other options)
|
- ``search_terms`` - Terms to search for in package names (grabs all that is not other options)
|
||||||
|
|
||||||
Override Mode
|
Override Mode
|
||||||
------------
|
----------------------
|
||||||
``install-qt-official`` supports an override mode that passes all arguments after ``--override`` directly to the Qt installer CLI, and will ignore all the other params except ``--email`` and ``--pw`` if given prior to it
|
``install-qt-official`` supports an override mode that passes all arguments after ``--override`` directly to the Qt installer CLI, and will ignore all the other params except ``--email`` and ``--pw`` if given prior to it
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
@@ -122,7 +78,7 @@ When using override mode:
|
|||||||
* `More info here <https://doc.qt.io/qt-6/get-and-install-qt-cli.html>`_
|
* `More info here <https://doc.qt.io/qt-6/get-and-install-qt-cli.html>`_
|
||||||
|
|
||||||
Examples
|
Examples
|
||||||
--------
|
--------------
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
# Standard installation
|
# Standard installation
|
||||||
@@ -138,7 +94,7 @@ Examples
|
|||||||
aqt install-qt-official --override install qt.qt6.680.gcc_64 --email user@example.com --pw pass
|
aqt install-qt-official --override install qt.qt6.680.gcc_64 --email user@example.com --pw pass
|
||||||
|
|
||||||
Advanced configs
|
Advanced configs
|
||||||
--------------
|
--------------------------
|
||||||
The file located in ``./aqt/settings.ini`` can be edited in the ``[qtofficial]`` part to fine tune the official installer (`more details here <https://doc.qt.io/qt-6/get-and-install-qt-cli.html#message-identifiers-for-auto-answer>`_):
|
The file located in ``./aqt/settings.ini`` can be edited in the ``[qtofficial]`` part to fine tune the official installer (`more details here <https://doc.qt.io/qt-6/get-and-install-qt-cli.html#message-identifiers-for-auto-answer>`_):
|
||||||
|
|
||||||
.. code-block:: ini
|
.. code-block:: ini
|
||||||
|
|||||||
@@ -275,6 +275,17 @@ def test_get_install_command(monkeypatch, modules: Optional[List[str]], expected
|
|||||||
"stopProcessesForUpdates=Cancel,installationErrorWithCancel=Cancel,installationErrorWithIgnore=Ignore,"
|
"stopProcessesForUpdates=Cancel,installationErrorWithCancel=Cancel,installationErrorWithIgnore=Ignore,"
|
||||||
"AssociateCommonFiletypes=Yes,telemetry-question=No install qt.{}.{}.{}",
|
"AssociateCommonFiletypes=Yes,telemetry-question=No install qt.{}.{}.{}",
|
||||||
),
|
),
|
||||||
|
(
|
||||||
|
"install-qt linux desktop 6.8.1 {} --outputdir ./install-qt-flag --use-official-installer {} {}",
|
||||||
|
{"windows": "win64_msvc2022_64", "linux": "linux_gcc_64", "mac": "clang_64"},
|
||||||
|
["./install-qt-official", "qt6", "681"],
|
||||||
|
"qt-unified-{}-x64-online.run --email ******** --pw ******** --root {} "
|
||||||
|
"--accept-licenses --accept-obligations "
|
||||||
|
"--confirm-command "
|
||||||
|
"--auto-answer OperationDoesNotExistError=Ignore,OverwriteTargetDirectory=Yes,"
|
||||||
|
"stopProcessesForUpdates=Cancel,installationErrorWithCancel=Cancel,installationErrorWithIgnore=Ignore,"
|
||||||
|
"AssociateCommonFiletypes=Yes,telemetry-question=No install qt.{}.{}.{}",
|
||||||
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_install_qt_commercial(
|
def test_install_qt_commercial(
|
||||||
|
|||||||
Reference in New Issue
Block a user