From 9875bc66132672ea46bdb1d2797b956012300b4d Mon Sep 17 00:00:00 2001 From: sithlord48 Date: Sat, 2 Nov 2024 11:38:24 -0400 Subject: [PATCH] chore: Remove unused install deps scripts and related parts --- Brewfile | 7 - Chocolatey.config | 8 -- config.yaml | 205 ------------------------------ scripts/install_deps.py | 274 ---------------------------------------- scripts/install_deps.sh | 78 ------------ scripts/lib/config.py | 129 ------------------- scripts/lib/qt_utils.py | 88 ------------- scripts/lib/vcpkg.py | 65 ---------- scripts/lib/windows.py | 30 ----- scripts/pyproject.toml | 3 +- 10 files changed, 1 insertion(+), 886 deletions(-) delete mode 100644 Brewfile delete mode 100644 Chocolatey.config delete mode 100644 config.yaml delete mode 100755 scripts/install_deps.py delete mode 100755 scripts/install_deps.sh delete mode 100644 scripts/lib/config.py delete mode 100644 scripts/lib/qt_utils.py delete mode 100644 scripts/lib/vcpkg.py diff --git a/Brewfile b/Brewfile deleted file mode 100644 index 259eb77a1..000000000 --- a/Brewfile +++ /dev/null @@ -1,7 +0,0 @@ -brew 'make' -brew 'cmake' -brew 'openssl' -brew 'ninja' -brew 'googletest' -brew 'tomlplusplus' -brew 'cli11' diff --git a/Chocolatey.config b/Chocolatey.config deleted file mode 100644 index 4c95c5d8a..000000000 --- a/Chocolatey.config +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/config.yaml b/config.yaml deleted file mode 100644 index 2d6685b82..000000000 --- a/config.yaml +++ /dev/null @@ -1,205 +0,0 @@ -config: - windows: - dependencies: - # We only run `choco` when not in CI env because it's pretty unreliable and slow. - # The Chocolatey mirror cannot be 100% reliable (according to docs) so it will often fail - # with an error `503 (Service Unavailable: Back-end server is at capacity)` which causes - # the nightly CI to fail intermittently. - command-elevated: if not defined CI (choco install Chocolatey.config -y) - - # We only run `winget` when not in CI env; it's not available on the GitHub Windows runner. - # It's simpler to solve dependencies like Ninja with a GitHub workflow action, and cmake is - # already installed on the Windows runner. - command: if not defined CI (winget install ninja-build.ninja cmake) - qt: - version: 6.7.2 - mirror: https://qt.mirror.constant.com/ - base-dir: ./deps/qt - - mac: - dependencies: - command: brew bundle --file=Brewfile - qt: - version: 6.7.2 - mirror: https://qt.mirror.constant.com/ - base-dir: ./deps/qt - - linux: - debian: &debian - dependencies: - command-pre: sudo apt-get update - command: | - sudo apt-get install -y \ - cmake \ - make \ - ninja-build \ - g++ \ - file \ - xorg-dev \ - libx11-dev \ - libxtst-dev \ - libssl-dev \ - libglib2.0-dev \ - libgdk-pixbuf-2.0-dev \ - libnotify-dev \ - libxkbfile-dev \ - qt6-base-dev \ - qt6-tools-dev \ - libgtk-3-dev \ - libgtest-dev \ - libgmock-dev \ - libpugixml-dev \ - libei-dev \ - libportal-dev \ - libtomlplusplus-dev \ - libcli11-dev - optional: [libei-dev, libportal-dev, libtomlplusplus-dev] - - linuxmint: - <<: *debian - - ubuntu: - <<: *debian - - fedora: &fedora - dependencies: &fedora_deps - command-pre: sudo dnf check-update - command: | - sudo dnf install -y \ - cmake \ - make \ - ninja-build \ - gcc-c++ \ - rpm-build \ - openssl-devel \ - glib2-devel \ - gdk-pixbuf2-devel \ - libXtst-devel \ - libnotify-devel \ - libxkbfile-devel \ - qt6-qtbase-devel \ - qt6-qttools-devel \ - gtk3-devel \ - gtest-devel \ - gmock-devel \ - pugixml-devel \ - libei-devel \ - libportal-devel \ - tomlplusplus-devel \ - cli11-devel - optional: [libei-devel, libportal-devel] - - # RHEL is not actually supported yet, since it doesn't have Qt6 libs. - # We simply use it as a base for Alma Linux and Rocky Linux. - rhel: &rhel - <<: *fedora - dependencies: &rhel_deps - <<: *fedora_deps - command-pre: | - sudo dnf check-update; - sudo dnf install -y epel-release; - dnf config-manager --set-enabled crb - - rocky: - <<: *rhel - dependencies: - <<: *rhel_deps - - almalinux: - <<: *rhel - dependencies: - <<: *rhel_deps - - opensuse-tumbleweed: &opensuse-tumbleweed - dependencies: - command-pre: sudo zypper refresh - command: sudo zypper install -y --force-resolution \ - cmake \ - make \ - ninja \ - gcc-c++ \ - rpm-build \ - libopenssl-devel \ - glib2-devel \ - gdk-pixbuf-devel \ - libXtst-devel \ - libnotify-devel \ - libxkbfile-devel \ - qt6-base-devel \ - qt6-tools-devel \ - gtk3-devel \ - googletest-devel \ - googlemock-devel \ - pugixml-devel \ - libei-devel \ - libportal-devel \ - tomlplusplus-devel \ - cli11-devel - - arch: &arch - dependencies: - command: sudo pacman -Syu --noconfirm \ - base-devel \ - cmake \ - ninja \ - gcc \ - openssl \ - glib2 \ - gdk-pixbuf2 \ - libxtst \ - libnotify \ - libxkbfile \ - gtest \ - pugixml \ - libei \ - libportal \ - qt6-base \ - qt6-tools \ - gtk3 \ - tomlplusplus \ - cli11 - - manjaro: - <<: *arch - - subprojects: - libei: - dependencies: - debian: &debian_libei | - sudo apt-get install -y \ - python3-attr \ - python3-jinja2 \ - libsystemd-dev && - pip install attrs jinja2 - - ubuntu: *debian_libei - linuxmint: *debian_libei - - fedora: &fedora_libei | - sudo dnf install -y \ - python3-attrs \ - python3-jinja2 \ - systemd-devel && - pip install attrs jinja2 - - rhel: *fedora_libei - rocky: *fedora_libei - almalinux: *fedora_libei - - libportal: - dependencies: - debian: &debian_libportal | - sudo apt-get install -y \ - python3-dbusmock \ - python3-pytest \ - valac \ - protobuf-c-compiler \ - protobuf-compiler \ - libglib2.0 \ - libgtk-3-dev \ - libprotobuf-c-dev \ - libsystemd-dev \ - libgirepository1.0-dev - - ubuntu: *debian_libportal - linuxmint: *debian_libportal diff --git a/scripts/install_deps.py b/scripts/install_deps.py deleted file mode 100755 index 346a0e644..000000000 --- a/scripts/install_deps.py +++ /dev/null @@ -1,274 +0,0 @@ -#!/usr/bin/env python3 - -# Deskflow -- mouse and keyboard sharing utility -# Copyright (C) 2024 Symless Ltd. -# -# This package is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# found in the file LICENSE that should have accompanied this file. -# -# This package is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -import os, sys, argparse, traceback -import lib.env as env -import lib.cmd_utils as cmd_utils -import lib.qt_utils as qt_utils -import lib.github as github - -path_env_var = "PATH" -cmake_prefix_env_var = "CMAKE_PREFIX_PATH" - - -def main(): - is_ci = os.getenv("CI") is not None - if is_ci: - print("CI environment detected") - - args = parse_args(is_ci) - if args.lock_file: - env.persist_lock_file(args.lock_file) - - try: - run(args) - except Exception: - traceback.print_exc() - sys.exit(1) - finally: - if env.is_windows() and args.pause_on_exit: - # Allow the rest of the install to continue while sitting at the pause. - if args.lock_file: - env.remove_lock_file(args.lock_file) - - # 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. - print() - input("Press enter to continue...") - - -def parse_args(is_ci): - parser = argparse.ArgumentParser() - - parser.add_argument( - "--ci-env", - action="store_true", - help="Useful for faking CI env (defaults to true in CI env)", - default=is_ci, - ) - parser.add_argument( - "--lock-file", - type=str, - help="Create a file to indicate script is running", - ) - parser.add_argument( - "--only-python", action="store_true", help="Only install Python dependencies" - ) - parser.add_argument( - "--skip-python", - action="store_true", - help="Do not install Python dependencies", - ) - parser.add_argument( - "--skip-system", - action="store_true", - help="Do not install system dependencies (apt, dnf, etc)", - ) - - if env.is_windows(): - parser.add_argument( - "--skip-vcpkg", - action="store_true", - help="Windows only: Do not install vcpkg dependencies", - ) - parser.add_argument( - "--skip-elevated", - action="store_true", - help="Windows only: Do not run elevated command", - ) - parser.add_argument( - "--only-elevated", - action="store_true", - help="Windows only: Only run elevated command", - ) - parser.add_argument( - "--pause-on-exit", - action="store_true", - help="Windows only: Useful to prevent elevated window from closing", - ) - - return parser.parse_args() - - -def run(args): - env.ensure_dependencies() - env.ensure_in_venv(__file__, create_venv=True) - - if not args.skip_python: - env.install_requirements() - - colors = env.import_colors() - - if args.only_python: - print() - print(colors.SUCCESS_TEXT + " Only Python dependencies installed") - return - - try: - install(args) - - print() - print(f"\n{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} You may need to restart your terminal " - "or IDE to use new env vars" - ) - except Exception: - traceback.print_exc() - print() - print(f"\n{colors.ERROR_TEXT} Failed to install dependencies") - sys.exit(1) - - -def install(args): - if not args.skip_system: - deps = Dependencies(args) - deps.install() - - # Only install vcpkg dependencies on Windows, since on other OS it's not needed (yet). - # We probably won't ever need this on macOS and Linux since brew and apt/dnf/etc do a - # good job of providing dependencies. Where they don't, we can use Meson. - if env.is_windows() and not args.skip_vcpkg: - import lib.vcpkg as vcpkg - - vcpkg.install(args.ci_env) - - -class Dependencies: - - def __init__(self, args): - from lib.config import Config - - self.config = Config() - self.args = args - self.ci_env = args.ci_env - - def install(self): - """Installs dependencies for the current platform.""" - - if env.is_windows(): - self.windows() - elif env.is_mac(): - self.mac() - elif env.is_linux(): - self.linux() - else: - raise RuntimeError(f"Unsupported platform: {os}") - - def windows(self): - """Installs dependencies on Windows.""" - import lib.windows as windows - - if not self.args.skip_elevated: - if windows.is_admin(): - - # The choco command should run from the elevated command. - choco = windows.WindowsChoco() - choco.ensure_choco_installed() - command_elevated = self.config.get_os_deps_command("command-elevated") - cmd_utils.run(command_elevated, shell=True, print_cmd=True) - - if self.args.only_elevated: - sys.exit(0) - else: - windows.run_elevated( - __file__, "--only-elevated --skip-python", wait_for_exit=True - ) - - qt = qt_utils.WindowsQt(*self.config.get_qt_config()) - qt.install() - - if self.ci_env: - github.set_env_var(cmake_prefix_env_var, qt.get_install_dir()) - else: - windows.set_env_var(cmake_prefix_env_var, qt.get_install_dir()) - - command = self.config.get_os_deps_command() - - cmd_utils.run(command, shell=True, print_cmd=True) - - def mac(self): - """Installs dependencies on macOS.""" - 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.install() - - qt_dir = qt.get_install_dir() - qt_bin_dir = os.path.join(qt_dir, "bin") - env_vars_set = 0 - if self.ci_env: - github.set_env_var(cmake_prefix_env_var, qt_dir) - github.add_to_path(qt_bin_dir) - else: - env_vars_set += mac.set_env_var(cmake_prefix_env_var, qt_dir) - env_vars_set += mac.set_env_var(path_env_var, qt_bin_dir) - - command = self.config.get_os_deps_command() - cmd_utils.run(command, shell=True, print_cmd=True) - - if env_vars_set: - print(f"To load env vars, run: source {mac.SHELL_RC}") - - def linux(self): - """Installs dependencies on Linux.""" - import lib.linux as linux - - distro, distro_like, _distro_version = env.get_linux_distro() - if not distro: - raise RuntimeError("Unable to detect Linux distro") - - command_pre = self.config.get_os_deps_command_pre( - linux_distro=distro, required=False - ) - if command_pre: - print("Running dependencies prerequisites command") - - check = True - if distro == "fedora" or (distro_like and "fedora" in distro_like): - print( - "Fedora-like detected, " - "ignoring return code on dependencies prerequisites command" - ) - # On Fedora-like, dnf update returns code 100 when updates are available. - check = False - - linux.run_command(command_pre, check) - - command = self.config.get_os_deps_command(linux_distro=distro) - optional = self.config.get_os_deps_value( - "optional", linux_distro=distro, required=False - ) - for optional_package in optional or []: - if not linux.is_package_available(optional_package): - print(f"Optional package not found, stripping: {optional_package}") - command = command.replace(optional_package, "") - - linux.run_command(command, check=True) - -if __name__ == "__main__": - main() diff --git a/scripts/install_deps.sh b/scripts/install_deps.sh deleted file mode 100755 index 9034b986e..000000000 --- a/scripts/install_deps.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/env sh - -SUDO=$(which sudo > /dev/null 2>&1 && echo "sudo" || echo "") - -install_deps() { - uname_out="$(uname -s)" - case "${uname_out}" in - FreeBSD*) install_freebsd ;; - OpenBSD*) install_openbsd ;; - NetBSD*) install_netbsd ;; - DragonFly*) install_dragonfly ;; - SunOS*) install_solaris ;; - *) install_other $@ ;; - esac -} - -install_freebsd() { - run_cmd pkg install -y \ - cmake \ - ninja \ - gmake \ - gcc10 \ - openssl \ - glib \ - gdk-pixbuf2 \ - libX11 \ - libXtst \ - libnotify \ - libxkbfile \ - qt6-base \ - qt6-tools \ - gtk3 \ - googletest \ - pugixml \ - tomlplusplus \ - cli11 -} - -install_openbsd() { - # Patches welcome! - # pkg_add error: - # Can't find libX11 - # Can't find libXtst - echo "Sorry, OpenBSD is not supported yet." -} - -install_netbsd() { - # Patches welcome! - # pkg_add error: - # pkg_add: no pkg found for 'libX11', sorry. - # pkg_add: no pkg found for 'libXtst', sorry. - echo "Sorry, NetBSD is not supported yet." -} - -install_dragonfly() { - # Patches welcome! - # The C++ version on DragonFly BSD seems to be too old. - echo "Sorry, DragonFly BSD is not supported yet." -} - -install_solaris() { - # Patches welcome! - echo "Sorry, Solaris is not supported yet." -} - -install_other() { - # TODO: Port the .py script to shell script to make the deps installation lighter on - # Linux and macOS. The .py script is probably only really needed to deal with Windows. - ./scripts/install_deps.py $@ -} - -run_cmd() { - cmd="${SUDO:+$SUDO }$@" - echo "Running: $cmd" - $cmd -} - -install_deps $@ diff --git a/scripts/lib/config.py b/scripts/lib/config.py deleted file mode 100644 index 27d579043..000000000 --- a/scripts/lib/config.py +++ /dev/null @@ -1,129 +0,0 @@ -# Deskflow -- mouse and keyboard sharing utility -# Copyright (C) 2024 Symless Ltd. -# -# This package is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# found in the file LICENSE that should have accompanied this file. -# -# This package is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -import yaml -import lib.env as env -import lib.cmd_utils as cmd_utils - -config_file = "config.yaml" -root_key = "config" -deps_key = "dependencies" -command_key = "command" -command_pre_key = "command-pre" -subprojects_key = "subprojects" -arrow = " ➤ " - - -class ConfigKeyError(RuntimeError): - def __init__(self, config_file, key): - self.config_file = config_file - self.key = key - - def __str__(self): - return f"Not found in {self.config_file}: {self.key}" - - -def _get(dict, key, key_parent=None, required=True): - value = dict.get(key) - - if required and not value: - key_path = f"{root_key}{arrow}{key_parent}{arrow}{key}" if key_parent else key - raise ConfigKeyError(config_file, key_path) - - return value - - -class Config: - """Reads the project configuration YAML file.""" - - def __init__(self): - - with open(config_file, "r") as f: - data = yaml.safe_load(f) - - self.os_name = env.get_os() - - print("Config for OS:", self.os_name) - self.root = _get(data, root_key) - self.os = _get(self.root, self.os_name) - - def get_os_value(self, key, required=True, linux_distro=None): - if linux_distro: - # recurse with the linux distro as the key parameter to get the base distro key. - distro = self.get_os_value(key=linux_distro) - return _get(distro, key, f"{self.os_name}{arrow}{linux_distro}", required) - else: - return _get(self.os, key, self.os_name, required) - - def get_qt_config(self): - qt_key = "qt" - qt = self.get_os_deps_value(qt_key) - - parent_key = f"{self.os_name}{arrow}{deps_key}" - mirror_url = _get(qt, "mirror", parent_key) - version = _get(qt, "version", parent_key) - base_dir = _get(qt, "base-dir", parent_key) - modules = _get(qt, "modules", parent_key, required=False) - - return mirror_url, version, base_dir, modules - - def get_os_deps_value(self, key, required=True, linux_distro=None): - deps = self.get_os_value(deps_key, required, linux_distro) - if linux_distro: - key_parent = f"{self.os_name}{arrow}{linux_distro}{arrow}{deps_key}" - else: - key_parent = f"{self.os_name}{arrow}{deps_key}" - return _get(deps, key, key_parent, required) - - def get_os_deps_command(self, key=command_key, required=True, linux_distro=None): - command = self.get_os_deps_value(key, required, linux_distro) - if command: - return cmd_utils.strip_continuation_sequences(command) - else: - return None - - def get_os_subprojects(self): - distro, _distro_like, _distro_version = env.get_linux_distro() - return self.get_os_value(subprojects_key, linux_distro=distro, required=False) - - def get_subproject_deps_command(self, subproject_name): - subprojects = _get(self.root, subprojects_key) - subproject = _get(subprojects, subproject_name, subprojects_key) - deps_parent = f"{subprojects_key}{arrow}{subproject_name}" - deps = _get(subproject, deps_key, deps_parent) - - if env.is_linux(): - distro, _distro_like, _distro_version = env.get_linux_distro() - if not distro: - raise RuntimeError("Unable to detect Linux distro") - - command = _get(deps, distro, f"{deps_parent}{arrow}{deps_key}") - else: - command = _get(deps, self.os_name, f"{deps_parent}{arrow}{deps_key}") - - return cmd_utils.strip_continuation_sequences(command) - - def get_os_deps_command_pre(self, required=True, linux_distro=None): - return self.get_os_deps_command(command_pre_key, required, linux_distro) - - def get_windows_ci_config(self): - choco_ci_key = "ci" - choco_ci = self.get_os_deps_value(choco_ci_key) - - choco_ci_path = f"{self.os_name}{arrow}{deps_key}{arrow}{choco_ci_key}" - edit_config = _get(choco_ci, "edit-config", choco_ci_path) - skip_packages = _get(choco_ci, "skip-packages", choco_ci_path) - - return edit_config, skip_packages diff --git a/scripts/lib/qt_utils.py b/scripts/lib/qt_utils.py deleted file mode 100644 index 61e577470..000000000 --- a/scripts/lib/qt_utils.py +++ /dev/null @@ -1,88 +0,0 @@ -# Deskflow -- mouse and keyboard sharing utility -# Copyright (C) 2024 Symless Ltd. -# -# This package is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# found in the file LICENSE that should have accompanied this file. -# -# This package is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -import os, sys -import lib.cmd_utils as cmd_utils -import glob - - -class Qt: - def __init__( - self, mirror_url, version, base_dir, modules, os_name, compiler, tool_dir - ): - self.mirror_url = mirror_url - self.version = version - self.base_dir = base_dir - self.modules = modules - self.os_name = os_name - self.compiler = compiler - self.tool_dir = tool_dir - self.dir_pattern = f"{self.base_dir}{os.sep}{self.version}*/{self.tool_dir}" - - def get_install_dir(self): - match = glob.glob(self.dir_pattern) - return os.path.abspath(match[0]) if match else None - - def install(self): - """Install Qt.""" - - if self.get_install_dir(): - print(f"Skipping Qt, already installed at: {self.dir_pattern}") - return - - args = [sys.executable, "-m", "aqt", "install-qt"] - args.extend(["--outputdir", self.base_dir]) - args.extend(["--base", self.mirror_url]) - args.extend([self.os_name, "desktop", str(self.version), self.compiler]) - - if self.modules: - args.extend(["-m"] + self.modules) - - print(args) - cmd_utils.run( - args, - print_cmd=True, - ) - - if not self.get_install_dir(): - raise RuntimeError( - f"Qt was not installed, path not found: {self.dir_pattern}" - ) - - -class WindowsQt(Qt): - def __init__(self, mirror_url, version, base_dir, modules): - super().__init__( - mirror_url, - version, - base_dir, - modules, - "windows", - "win64_msvc2019_64", - "msvc2019_64", - ) - - -class MacQt(Qt): - def __init__(self, mirror_url, version, base_dir, modules): - super().__init__( - mirror_url, - version, - base_dir, - modules, - "mac", - "clang_64", - "macos", - ) diff --git a/scripts/lib/vcpkg.py b/scripts/lib/vcpkg.py deleted file mode 100644 index b2a5303aa..000000000 --- a/scripts/lib/vcpkg.py +++ /dev/null @@ -1,65 +0,0 @@ -# Deskflow -- mouse and keyboard sharing utility -# Copyright (C) 2024 Symless Ltd. -# -# This package is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# found in the file LICENSE that should have accompanied this file. -# -# This package is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -import os -import git # type: ignore -import lib.env as env -import lib.cmd_utils as cmd_utils - -GIT_REPO = "https://github.com/microsoft/vcpkg.git" - - -def install(ci_env): - vcpkg_bin = ensure_vcpkg(ci_env) - - cmd_utils.run([vcpkg_bin, "install"], print_cmd=True) - - -def ensure_vcpkg(ci_env): - # Don't use the local vcpkg if we're in CI, since this makes caching complicated. - if not ci_env and cmd_utils.has_command("vcpkg"): - print("Using system vcpkg") - return "vcpkg" - - if not os.path.exists("vcpkg"): - get_vcpkg() - else: - print("Updating vcpkg...") - repo = git.Repo("vcpkg") - repo.remotes.origin.pull() - - if env.is_windows(): - vcpkg_bin = "vcpkg/vcpkg.exe" - else: - vcpkg_bin = "vcpkg/vcpkg" - - if not os.path.exists(vcpkg_bin): - raise RuntimeError(f"Path not found: {vcpkg_bin}") - - return vcpkg_bin - - -def get_vcpkg(): - print("Downloading vcpkg...") - git.Repo.clone_from(GIT_REPO, "vcpkg") - - os.chdir("vcpkg") - try: - if env.is_windows(): - cmd_utils.run("bootstrap-vcpkg.bat", shell=True, print_cmd=True) - else: - cmd_utils.run("./bootstrap-vcpkg.sh", shell=True, print_cmd=True) - finally: - os.chdir("..") diff --git a/scripts/lib/windows.py b/scripts/lib/windows.py index d93a4aa1b..1ca6ea2a9 100644 --- a/scripts/lib/windows.py +++ b/scripts/lib/windows.py @@ -196,36 +196,6 @@ class WindowsPackager: run_codesign(path, cert_base64, cert_password) -class WindowsChoco: - """Chocolatey for Windows.""" - - 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, please install Chocolatey manually", - 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) - - class WindowsService: def __init__(self, script, args): self.script = script diff --git a/scripts/pyproject.toml b/scripts/pyproject.toml index 3de1f1ceb..daac624ef 100644 --- a/scripts/pyproject.toml +++ b/scripts/pyproject.toml @@ -8,8 +8,7 @@ dependencies = [ "python-dotenv", "pyyaml", "dmgbuild; sys_platform == 'darwin'", - "aqtinstall; sys_platform == 'win32' or sys_platform == 'darwin'", "colorama", - "meson", "gitpython", + "psutil", ]