More robust choco install and helpful install_deps.py messages (#7461)
* Only show error/success conditionally * Make choco install more robust * Improve deps script to remind about restarting shells * Add note about Mac Qt * Update ChangeLog
This commit is contained in:
parent
bcdf70a298
commit
8778a305f4
4 changed files with 47 additions and 9 deletions
|
|
@ -7,6 +7,7 @@ Enhancements:
|
||||||
- #7445 Update `config.yaml` to support Linux Mint build target
|
- #7445 Update `config.yaml` to support Linux Mint build target
|
||||||
- #7453 Change default value for dev thanks message
|
- #7453 Change default value for dev thanks message
|
||||||
- #7455 Use EI screen when XDG_SESSION_TYPE is "wayland"
|
- #7455 Use EI screen when XDG_SESSION_TYPE is "wayland"
|
||||||
|
- #7461 More robust `choco` install and helpful `install_deps.py` messages
|
||||||
|
|
||||||
# 1.15.1
|
# 1.15.1
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,9 +52,23 @@ def main():
|
||||||
|
|
||||||
colors = env.import_colors()
|
colors = env.import_colors()
|
||||||
print()
|
print()
|
||||||
print(f"{colors.SUCCESS_TEXT} Dependencies installed")
|
|
||||||
|
|
||||||
|
if error:
|
||||||
|
print(f"{colors.ERROR_TEXT} Failed to install dependencies")
|
||||||
|
else:
|
||||||
|
print(f"{colors.SUCCESS_TEXT} Dependencies installed")
|
||||||
|
|
||||||
|
# On Windows and macOS, we set env vars for cmake, but for them to be picked up,
|
||||||
|
# either the shell needs to be restarted or the env vars need to be re-sourced.
|
||||||
|
# Restarting the shell is easier for most people.
|
||||||
|
if not env.is_linux():
|
||||||
|
print(f"{colors.WARNING_TEXT} Please restart your shells for new env vars")
|
||||||
|
|
||||||
|
# Useful on Windows, when elevated, Python is opened in a new window and closes
|
||||||
|
# immediately after the script finishes. This keeps the script window open so that
|
||||||
|
# the user can see the output.
|
||||||
if args.pause_on_exit:
|
if args.pause_on_exit:
|
||||||
|
print()
|
||||||
input("Press enter to continue...")
|
input("Press enter to continue...")
|
||||||
|
|
||||||
if error:
|
if error:
|
||||||
|
|
@ -138,6 +152,10 @@ class Dependencies:
|
||||||
"""Installs dependencies on macOS."""
|
"""Installs dependencies on macOS."""
|
||||||
import lib.mac as mac
|
import lib.mac as mac
|
||||||
|
|
||||||
|
# On macOS, brew does have a Qt package available, but it is always built against the
|
||||||
|
# current macOS version and the brew version also does some really weird stuff with the
|
||||||
|
# library symbols, which confuses the heck out of `macqtdeploy`. So, using the official
|
||||||
|
# Qt library binaries seems to be the most reliable option for distribution.
|
||||||
qt = qt_utils.MacQt(*self.config.get_qt_config())
|
qt = qt_utils.MacQt(*self.config.get_qt_config())
|
||||||
qt.install()
|
qt.install()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ from colorama import Fore # type: ignore
|
||||||
|
|
||||||
colorama.init()
|
colorama.init()
|
||||||
|
|
||||||
SUCCESS_TEXT = f"{Fore.GREEN}Success:{Fore.RESET}"
|
SUCCESS_TEXT = f"{Fore.LIGHTGREEN_EX}Success:{Fore.RESET}"
|
||||||
ERROR_TEXT = f"{Fore.RED}Error:{Fore.RESET}"
|
ERROR_TEXT = f"{Fore.RED}Error:{Fore.RESET}"
|
||||||
WARNING_TEXT = f"{Fore.YELLOW}Warning:{Fore.RESET}"
|
WARNING_TEXT = f"{Fore.LIGHTYELLOW_EX}Warning:{Fore.RESET}"
|
||||||
HINT_TEXT = f"{Fore.LIGHTBLUE_EX}Hint:{Fore.RESET}"
|
HINT_TEXT = f"{Fore.LIGHTBLUE_EX}Hint:{Fore.RESET}"
|
||||||
|
|
|
||||||
|
|
@ -147,12 +147,8 @@ class WindowsChoco:
|
||||||
print_cmd=True,
|
print_cmd=True,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
cmd_utils.run(
|
self.ensure_choco_installed()
|
||||||
"winget install chocolatey",
|
|
||||||
check=False,
|
|
||||||
shell=True,
|
|
||||||
print_cmd=True,
|
|
||||||
)
|
|
||||||
cmd_utils.run(
|
cmd_utils.run(
|
||||||
command,
|
command,
|
||||||
shell=True,
|
shell=True,
|
||||||
|
|
@ -186,3 +182,26 @@ class WindowsChoco:
|
||||||
print(f"Removed package from choco config: {remove}")
|
print(f"Removed package from choco config: {remove}")
|
||||||
|
|
||||||
tree.write(choco_config_file)
|
tree.write(choco_config_file)
|
||||||
|
|
||||||
|
def ensure_choco_installed(self):
|
||||||
|
if cmd_utils.has_command("choco"):
|
||||||
|
return
|
||||||
|
|
||||||
|
if not cmd_utils.has_command("winget"):
|
||||||
|
print("The winget command was not found", file=sys.stderr)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
print("The choco command was not found, installing Chocolatey...")
|
||||||
|
cmd_utils.run(
|
||||||
|
"winget install chocolatey",
|
||||||
|
check=False,
|
||||||
|
shell=True,
|
||||||
|
print_cmd=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
if not cmd_utils.has_command("choco"):
|
||||||
|
print(
|
||||||
|
"The choco command was still not found, please re-run this script...",
|
||||||
|
file=sys.stderr,
|
||||||
|
)
|
||||||
|
sys.exit(1)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue