From fc5b997288005759718ddb6498e79a2d41d6d9d1 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 19 Aug 2024 10:11:39 +0200 Subject: [PATCH] run pip from python --- spcd.sh | 10 ---------- spcd/__init__.py | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/spcd.sh b/spcd.sh index 0d53b0e..34d6e52 100644 --- a/spcd.sh +++ b/spcd.sh @@ -674,16 +674,6 @@ index-url = ${SPCD_URL_PYTHON} spcd_split export PATH="${SPCD_PYTHON_VENV_BINARIES}:${PATH}" export VIRTUAL_ENV="${SPCD_PYTHON_VENV}" - spcd_split - pip install --upgrade "pip" - spcd_split - pip install \ - "mypy" \ - "pelican" \ - "pytest" \ - "ruff" \ - "sphinx" "sphinx-rtd-theme" \ - "twine" } spcd_install_python_modules() { diff --git a/spcd/__init__.py b/spcd/__init__.py index 3532b60..a6f35d0 100644 --- a/spcd/__init__.py +++ b/spcd/__init__.py @@ -53,6 +53,25 @@ def install_commands(path: str) -> None: (user / f"{COMMANDS_PREFIX}{command}").symlink_to(path) +def install_python_packages() -> None: + step("Install Python packages") + log.info("pip") + run("pip", "install", "--upgrade", "pip") + split() + packages = [ + "mypy", + "pelican", + "pytest", + "ruff", + "sphinx", + "sphinx-rtd-theme", + "twine", + ] + for package in packages: + log.info(package) + run("pip", "install", *packages) + + def list_environment_variables() -> None: step("List environment variables") for variable, value in sorted(projects.environment.items()): @@ -73,6 +92,7 @@ def main(main: str) -> None: clone_project_branch() set_ssh() install_commands(main) + install_python_packages() else: function = getattr(cmd, name.replace("-", "_")) function(*arguments)