diff --git a/komodo/cli.py b/komodo/cli.py index 1ed34c3f..8d7f0c12 100755 --- a/komodo/cli.py +++ b/komodo/cli.py @@ -270,13 +270,10 @@ def install_previously_downloaded_pip_packages( pip_executable: str, release_root: Path, ) -> None: - for pkg, ver in release_file_content.items(): - current = repository_file_content[pkg][ver] - if current["make"] != "pip": - continue - - package_name = current.get("pypi_package_name", pkg) - shell_input = [ + def pip_shell_command( + package_name: str, ver: str, makeopts: Optional[str] + ) -> List[Optional[str]]: + return [ pip_executable, f"install {package_name}=={strip_version(ver)}", "--prefix", @@ -288,9 +285,17 @@ def install_previously_downloaded_pip_packages( # assuming fetch.py has done "pip download" to this directory: f"--cache-dir {downloads_directory}", f"--find-links {downloads_directory}", + makeopts, ] - shell_input.append(current.get("makeopts")) + for pkg, ver in release_file_content.items(): + pkg_data = repository_file_content[pkg][ver] + if pkg_data["make"] != "pip": + continue + + shell_input = pip_shell_command( + pkg_data.get("pypi_package_name", pkg), ver, pkg_data.get("makeopts") + ) print(shell(shell_input)) diff --git a/komodo/shell.py b/komodo/shell.py index 6448ef29..aa89bbe0 100644 --- a/komodo/shell.py +++ b/komodo/shell.py @@ -2,6 +2,7 @@ import os import subprocess import sys +from typing import List, Optional, Union @contextlib.contextmanager @@ -15,7 +16,7 @@ def pushd(path): os.chdir(prev) -def shell(cmd: str, allow_failure=False) -> bytes: +def shell(cmd: Union[str, List[Optional[str]]], allow_failure: bool = False) -> bytes: try: cmdlist = cmd.split(" ") except AttributeError: