From fd12e72cfd9ec1f00035cf25beb0caef561fca6f Mon Sep 17 00:00:00 2001 From: "Bradley A. Thornton" Date: Wed, 20 Sep 2023 08:20:26 -0700 Subject: [PATCH 1/5] Allow multiple collections to be installed --- 1.0 | 17 ++++ requirements.yml | 2 + src/pip4a/arg_parser.py | 7 +- src/pip4a/cli.py | 57 +++++++++--- src/pip4a/collection.py | 5 +- src/pip4a/config.py | 4 +- src/pip4a/subcommands/checker.py | 6 +- src/pip4a/subcommands/installer.py | 142 +++++++++++++++++------------ src/pip4a/subcommands/treemaker.py | 2 +- src/pip4a/utils.py | 12 ++- tests/integration/test_basic.py | 17 +++- 11 files changed, 180 insertions(+), 91 deletions(-) create mode 100644 1.0 create mode 100644 requirements.yml diff --git a/1.0 b/1.0 new file mode 100644 index 0000000..2f98988 --- /dev/null +++ b/1.0 @@ -0,0 +1,17 @@ + Debug: Virtual environment: /home/bthornto/github/pip4a/venv + Debug: Virtual environment interpreter: + /home/bthornto/github/pip4a/venv/bin/python + Debug: Running command: /home/bthornto/github/pip4a/venv/bin/python -c + 'import json,site; print(json.dumps(site.getsitepackages()))' +["/home/bthornto/github/pip4a/venv/lib64/python3.11/site-packages", "/home/bthornto/github/pip4a/venv/lib/python3.11/site-packages"] + Debug: Found site packages path: + /home/bthornto/github/pip4a/venv/lib64/python3.11/site-packages + Info: Installing ansible-core. + Info: Installing collections from requirements file: + /home/bthornto/github/pip4a/requirements.yml + Debug: Removing installed /home/bthornto/github/pip4a/venv/lib64/python3.11 + /site-packages/ansible_collections/community/general + Debug: Running command: /home/bthornto/github/pip4a/venv/bin/ansible-galaxy + collection install -r /home/bthornto/github/pip4a/requirements.yml + -p /home/bthornto/github/pip4a/venv/lib64/python3.11/site-packages + --force diff --git a/requirements.yml b/requirements.yml new file mode 100644 index 0000000..552adfe --- /dev/null +++ b/requirements.yml @@ -0,0 +1,2 @@ +collections: + - community.general diff --git a/src/pip4a/arg_parser.py b/src/pip4a/arg_parser.py index 99e05b6..bebc148 100644 --- a/src/pip4a/arg_parser.py +++ b/src/pip4a/arg_parser.py @@ -136,13 +136,12 @@ def parse() -> argparse.Namespace: ) level2 = ArgumentParser(add_help=False, parents=[level1]) - spec_or_req = level2.add_mutually_exclusive_group(required=True) - spec_or_req.add_argument( + level2.add_argument( "collection_specifier", help="Collection name or path to collection with extras.", - nargs="?", + nargs="*", ) - spec_or_req.add_argument( + level2.add_argument( "-r", "--requirement ", dest="requirement", diff --git a/src/pip4a/cli.py b/src/pip4a/cli.py index e5aba38..766c8f0 100644 --- a/src/pip4a/cli.py +++ b/src/pip4a/cli.py @@ -57,52 +57,81 @@ def init_output(self: Cli) -> None: def args_sanity(self: Cli) -> None: """Perform some sanity checking on the args.""" + # Missing args if ( hasattr(self.args, "requirement") and self.args.requirement and not self.args.requirement.exists() ): err = f"Requirements file not found: {self.args.requirement}" - self.output.error(err) + self.output.critical(err) + + # Multiple editable collections + if ( + hasattr(self.args, "collection_specifier") + and len(self.args.collection_specifier) > 1 + and self.args.editable + ): + err = "Editable can only be used with a single collection specifier." + self.output.critical(err) + + # Editable with requirements file + if hasattr(self.args, "requirement") and self.args.editable: + err = "Editable can not be used with a requirements file." + self.output.critical(err) def ensure_isolated(self: Cli) -> None: """Ensure the environment is isolated.""" env_vars = os.environ - errors = [] + errored = False if "ANSIBLE_COLLECTIONS_PATHS" in env_vars: err = "ANSIBLE_COLLECTIONS_PATHS is set" - errors.append(err) + self.output.error(err) + hint = "Run `unset ANSIBLE_COLLECTIONS_PATHS` to unset it." + self.output.hint(hint) + errored = True if "ANSIBLE_COLLECTION_PATH" in env_vars: err = "ANSIBLE_COLLECTION_PATH is set" - errors.append(err) + self.output.error(err) + hint = "Run `unset ANSIBLE_COLLECTION_PATH` to unset it." + self.output.hint(hint) + errored = True home_coll = Path.home() / ".ansible/collections/ansible_collections" if home_coll.exists() and tuple(home_coll.iterdir()): err = f"Collections found in {home_coll}" - errors.append(err) + self.output.error(err) + hint = "Run `rm -rf ~/.ansible/collections` to remove them." + self.output.hint(hint) + errored = True usr_coll = Path("/usr/share/ansible/collections") if usr_coll.exists() and tuple(usr_coll.iterdir()): err = f"Collections found in {usr_coll}" - errors.append(err) + self.output.error(err) + hint = "Run `sudo rm -rf /usr/share/ansible/collections` to remove them." + self.output.hint(hint) + errored = True if "VIRTUAL_ENV" not in env_vars and not self.args.venv: err = ( "Unable to use user site packages directory:" f" {site.getusersitepackages()}, please activate or specify a virtual environment" ) - errors.append(err) + self.output.error(err) + hint = ( + "Use `--venv ` to specify a virtual environment" + " or enable an existing one." + ) + self.output.hint(hint) + errored = True - if errors: + if errored: err = ( "The development environment is not isolated," - " please resolve the following errors:" + " please resolve the above errors." ) - self.output.error(err) - for error in errors: - err = f"- {error}" - self.output.error(err) - err = "Exiting." + self.output.critical(err) def run(self: Cli) -> None: diff --git a/src/pip4a/collection.py b/src/pip4a/collection.py index 7e254a5..8fe0e95 100644 --- a/src/pip4a/collection.py +++ b/src/pip4a/collection.py @@ -17,7 +17,7 @@ @dataclass -class Collection: +class Collection: # pylint: disable=too-many-instance-attributes """A collection request specification.""" config: Config @@ -27,6 +27,7 @@ class Collection: cnamespace: str | None = None cname: str | None = None specifier: str | None = None + original: str | None = None @property def name(self: Collection) -> str: @@ -72,7 +73,7 @@ def parse_collection_request( # noqa: PLR0915 Returns: A collection object """ - collection = Collection(config=config) + collection = Collection(config=config, original=string) # spec with dep, local if "[" in string and "]" in string: msg = f"Found optional dependencies in collection request: {string}" diff --git a/src/pip4a/config.py b/src/pip4a/config.py index e8f76b6..76dc58f 100644 --- a/src/pip4a/config.py +++ b/src/pip4a/config.py @@ -116,7 +116,7 @@ def _set_interpreter( command=command, verbose=self.args.verbose, msg=work, - term_features=self.term_features, + output=self._output, ) msg = f"Created virtual environment: {self.venv}" self._output.info(msg) @@ -149,7 +149,7 @@ def _set_site_pkg_path(self: Config) -> None: command=command, verbose=self.args.verbose, msg=work, - term_features=self.term_features, + output=self._output, ) except subprocess.CalledProcessError as exc: err = f"Failed to find site packages path: {exc}" diff --git a/src/pip4a/subcommands/checker.py b/src/pip4a/subcommands/checker.py index a34f312..d29f1c4 100644 --- a/src/pip4a/subcommands/checker.py +++ b/src/pip4a/subcommands/checker.py @@ -40,7 +40,7 @@ def __init__(self: Checker, config: Config, output: Output) -> None: def run(self: Checker) -> None: """Run the checker.""" - builder_introspect(config=self._config) + builder_introspect(config=self._config, output=self._output) self._collection_deps() self.system_deps() self._python_deps() @@ -151,7 +151,7 @@ def _python_deps(self: Checker) -> None: command=command, verbose=self._config.args.verbose, msg=work, - term_features=self._config.term_features, + output=self._output, ) except subprocess.CalledProcessError as exc: err = f"Failed to check python dependencies: {exc}" @@ -191,7 +191,7 @@ def system_deps(self: Checker) -> None: command=command, verbose=self._config.args.verbose, msg=work, - term_features=self._config.term_features, + output=self._output, ) except subprocess.CalledProcessError as exc: if exc.stderr: diff --git a/src/pip4a/subcommands/installer.py b/src/pip4a/subcommands/installer.py index c4799aa..5936fbd 100644 --- a/src/pip4a/subcommands/installer.py +++ b/src/pip4a/subcommands/installer.py @@ -36,8 +36,8 @@ def __init__(self: Installer, config: Config, output: Output) -> None: output: The application output object. """ self._config = config - self._collection: Collection self._output = output + self._current_collection_spec: str def run(self: Installer) -> None: """Run the installer.""" @@ -52,23 +52,32 @@ def run(self: Installer) -> None: if self._config.args.requirement: self._install_galaxy_requirements() - elif self._config.args.collection_specifier: - self._collection = parse_collection_request( - string=self._config.args.collection_specifier, - config=self._config, - output=self._output, - ) - if self._collection.local: - self._install_local_collection() + if self._config.args.collection_specifier: + collections = [ + parse_collection_request( + string=entry, + config=self._config, + output=self._output, + ) + for entry in self._config.args.collection_specifier + ] + local_collections = [ + collection for collection in collections if collection.local + ] + for local_collection in local_collections: + self._install_local_collection(collection=local_collection) if self._config.args.editable: - self._swap_editable_collection() - elif not self._collection.local: + self._swap_editable_collection(collection=local_collection) + distant_collections = [ + collection for collection in collections if not collection.local + ] + if distant_collections: if self._config.args.editable: msg = "Editable installs are only supported for local collections." self._output.critical(msg) - self._install_galaxy_collection() + self._install_galaxy_collections(collections=distant_collections) - builder_introspect(config=self._config) + builder_introspect(config=self._config, output=self._output) self._pip_install() Checker(config=self._config, output=self._output).system_deps() @@ -99,28 +108,35 @@ def _install_core(self: Installer) -> None: command=command, verbose=self._config.args.verbose, msg=msg, - term_features=self._config.term_features, + output=self._output, ) except subprocess.CalledProcessError as exc: err = f"Failed to install ansible-core: {exc}" self._output.critical(err) - def _install_galaxy_collection(self: Installer) -> None: + def _install_galaxy_collections( + self: Installer, + collections: list[Collection], + ) -> None: """Install the collection from galaxy.""" - msg = f"Installing collection from galaxy: {self._config.args.collection_specifier}" + collections_str = " ".join( + [f"'{collection.original}'" for collection in collections], + ) + msg = f"Installing collections from galaxy: {collections_str}" self._output.info(msg) - if self._collection.site_pkg_path.exists(): - msg = f"Removing installed {self._collection.site_pkg_path}" - self._output.debug(msg) - if self._collection.site_pkg_path.is_symlink(): - self._collection.site_pkg_path.unlink() - else: - shutil.rmtree(self._collection.site_pkg_path) + for collection in collections: + if collection.site_pkg_path.exists(): + msg = f"Removing installed {collection.site_pkg_path}" + self._output.debug(msg) + if collection.site_pkg_path.is_symlink(): + collection.site_pkg_path.unlink() + else: + shutil.rmtree(collection.site_pkg_path) command = ( f"{self._config.venv_bindir / 'ansible-galaxy'} collection" - f" install '{self._config.args.collection_specifier}'" + f" install {collections_str}" f" -p {self._config.site_pkg_path}" " --force" ) @@ -135,7 +151,7 @@ def _install_galaxy_collection(self: Installer) -> None: env=env, verbose=self._config.args.verbose, msg=msg, - term_features=self._config.term_features, + output=self._output, ) except subprocess.CalledProcessError as exc: err = f"Failed to install collection: {exc}\n{exc.stderr}" @@ -175,7 +191,7 @@ def _install_galaxy_requirements(self: Installer) -> None: command=command, verbose=self._config.args.verbose, msg=work, - term_features=self._config.term_features, + output=self._output, ) except subprocess.CalledProcessError as exc: err = f"Failed to install collections: {exc} {exc.stderr}" @@ -185,37 +201,44 @@ def _install_galaxy_requirements(self: Installer) -> None: msg = f"Installed collections include: {oxford_join(installed)}" self._output.note(msg) - def _install_local_collection(self: Installer) -> None: # noqa: PLR0912, PLR0915 + def _install_local_collection( # noqa: PLR0915, PLR0912 + self: Installer, + collection: Collection, + ) -> None: """Install the collection from the build directory. + Args: + collection: The collection object. + Raises: RuntimeError: If tarball is not found or if more than one tarball is found. """ - msg = f"Installing local collection from: {self._collection.build_dir}" + # pylint: disable=too-many-instance-attributes + msg = f"Installing local collection from: {collection.build_dir}" self._output.info(msg) command = ( "cp -r --parents $(git ls-files 2> /dev/null || ls)" - f" {self._collection.build_dir}" + f" {collection.build_dir}" ) msg = "Copying collection to build directory using git ls-files." self._output.debug(msg) try: subprocess_run( command=command, - cwd=self._collection.path, + cwd=collection.path, verbose=self._config.args.verbose, msg=msg, - term_features=self._config.term_features, + output=self._output, ) except subprocess.CalledProcessError as exc: err = f"Failed to copy collection to build directory: {exc} {exc.stderr}" self._output.critical(err) command = ( - f"cd {self._collection.build_dir} &&" + f"cd {collection.build_dir} &&" f" {self._config.venv_bindir / 'ansible-galaxy'} collection build" - f" --output-path {self._collection.build_dir}" + f" --output-path {collection.build_dir}" " --force" ) @@ -227,7 +250,7 @@ def _install_local_collection(self: Installer) -> None: # noqa: PLR0912, PLR091 command=command, verbose=self._config.args.verbose, msg=msg, - term_features=self._config.term_features, + output=self._output, ) except subprocess.CalledProcessError as exc: err = f"Failed to build collection: {exc} {exc.stderr}" @@ -235,31 +258,31 @@ def _install_local_collection(self: Installer) -> None: # noqa: PLR0912, PLR091 built = [ f - for f in Path(self._collection.build_dir).iterdir() + for f in Path(collection.build_dir).iterdir() if f.is_file() and f.name.endswith(".tar.gz") ] if len(built) != 1: err = ( "Expected to find one collection tarball in" - f"{self._collection.build_dir}, found {len(built)}" + f"{collection.build_dir}, found {len(built)}" ) raise RuntimeError(err) tarball = built[0] - if self._collection.site_pkg_path.exists(): - msg = f"Removing installed {self._collection.site_pkg_path}" + if collection.site_pkg_path.exists(): + msg = f"Removing installed {collection.site_pkg_path}" self._output.debug(msg) - if self._collection.site_pkg_path.is_symlink(): - self._collection.site_pkg_path.unlink() + if collection.site_pkg_path.is_symlink(): + collection.site_pkg_path.unlink() else: - shutil.rmtree(self._collection.site_pkg_path) + shutil.rmtree(collection.site_pkg_path) info_dirs = [ entry for entry in self._config.site_pkg_collections_path.iterdir() if entry.is_dir() and entry.name.endswith(".info") - and entry.name.startswith(self._collection.name) + and entry.name.startswith(collection.name) ] for info_dir in info_dirs: msg = f"Removing installed {info_dir}" @@ -282,7 +305,7 @@ def _install_local_collection(self: Installer) -> None: # noqa: PLR0912, PLR091 env=env, verbose=self._config.args.verbose, msg=msg, - term_features=self._config.term_features, + output=self._output, ) except subprocess.CalledProcessError as exc: err = f"Failed to install collection: {exc} {exc.stderr}" @@ -294,42 +317,45 @@ def _install_local_collection(self: Installer) -> None: # noqa: PLR0912, PLR091 # preserve the MANIFEST.json file for editable installs if not self._config.args.editable: shutil.copy( - self._collection.build_dir / "galaxy.yml", - self._collection.site_pkg_path / "galaxy.yml", + collection.build_dir / "galaxy.yml", + collection.site_pkg_path / "galaxy.yml", ) else: shutil.copy( - self._collection.site_pkg_path / "MANIFEST.json", - self._collection.cache_dir / "MANIFEST.json", + collection.site_pkg_path / "MANIFEST.json", + collection.cache_dir / "MANIFEST.json", ) installed = re.findall(r"(\w+\.\w+):.*installed", proc.stdout) msg = f"Installed collections include: {oxford_join(installed)}" self._output.note(msg) - def _swap_editable_collection(self: Installer) -> None: + def _swap_editable_collection(self: Installer, collection: Collection) -> None: """Swap the installed collection with the current working directory. + Args: + collection: The collection object. + Raises: RuntimeError: If the collection path is not set. """ - msg = f"Swapping {self._collection.name} with {self._collection.path}" + msg = f"Swapping {collection.name} with {collection.path}" self._output.info(msg) - if self._collection.path is None: + if collection.path is None: msg = "Collection path not set" raise RuntimeError(msg) - msg = f"Removing installed {self._collection.site_pkg_path}" + msg = f"Removing installed {collection.site_pkg_path}" self._output.debug(msg) - if self._collection.site_pkg_path.exists(): - if self._collection.site_pkg_path.is_symlink(): - self._collection.site_pkg_path.unlink() + if collection.site_pkg_path.exists(): + if collection.site_pkg_path.is_symlink(): + collection.site_pkg_path.unlink() else: - shutil.rmtree(self._collection.site_pkg_path) + shutil.rmtree(collection.site_pkg_path) - msg = f"Symlinking {self._collection.site_pkg_path} to {self._collection.path}" + msg = f"Symlinking {collection.site_pkg_path} to {collection.path}" self._output.debug(msg) - self._collection.site_pkg_path.symlink_to(self._collection.path) + collection.site_pkg_path.symlink_to(collection.path) def _pip_install(self: Installer) -> None: """Install the dependencies.""" @@ -351,7 +377,7 @@ def _pip_install(self: Installer) -> None: command=command, verbose=self._config.args.verbose, msg=work, - term_features=self._config.term_features, + output=self._output, ) except subprocess.CalledProcessError as exc: err = ( diff --git a/src/pip4a/subcommands/treemaker.py b/src/pip4a/subcommands/treemaker.py index 8a2e2eb..a067275 100644 --- a/src/pip4a/subcommands/treemaker.py +++ b/src/pip4a/subcommands/treemaker.py @@ -33,7 +33,7 @@ def __init__(self: TreeMaker, config: Config, output: Output) -> None: def run(self: TreeMaker) -> None: # noqa: C901, PLR0912, PLR0915 """Run the command.""" # pylint: disable=too-many-locals - builder_introspect(self._config) + builder_introspect(self._config, self._output) with self._config.discovered_python_reqs.open("r") as reqs_file: python_deps = reqs_file.read().splitlines() diff --git a/src/pip4a/utils.py b/src/pip4a/utils.py index a260a74..0dfcddd 100644 --- a/src/pip4a/utils.py +++ b/src/pip4a/utils.py @@ -22,6 +22,7 @@ from types import TracebackType from .config import Config + from .output import Output from typing import Any @@ -90,13 +91,13 @@ def subprocess_run( # noqa: PLR0913 command: str, verbose: int, msg: str, - term_features: TermFeatures, + output: Output, cwd: Path | None = None, env: dict[str, str] | None = None, ) -> subprocess.CompletedProcess[str]: """Run a subprocess command.""" cmd = f"Running command: {command}" - logger.debug(cmd) + output.debug(cmd) log_level = logging.ERROR - (verbose * 10) if log_level == logging.DEBUG: return subprocess_tee.run( @@ -107,7 +108,7 @@ def subprocess_run( # noqa: PLR0913 shell=True, # noqa: S604 text=True, ) - with Spinner(message=msg, term_features=term_features): + with Spinner(message=msg, term_features=output.term_features): return subprocess.run( command, check=True, @@ -240,11 +241,12 @@ def collect_manifests( # noqa: C901 return sort_dict(collections) -def builder_introspect(config: Config) -> None: +def builder_introspect(config: Config, output: Output) -> None: """Introspect a collection. Args: config: The configuration object. + output: The output object. """ command = ( f"ansible-builder introspect {config.site_pkg_path}" @@ -274,7 +276,7 @@ def builder_introspect(config: Config) -> None: command=command, verbose=config.args.verbose, msg=work, - term_features=config.term_features, + output=output, ) except subprocess.CalledProcessError as exc: err = f"Failed to discover requirements: {exc} {exc.stderr}" diff --git a/tests/integration/test_basic.py b/tests/integration/test_basic.py index 02ebf4b..073f7c4 100644 --- a/tests/integration/test_basic.py +++ b/tests/integration/test_basic.py @@ -7,6 +7,7 @@ import pytest from pip4a.cli import main +from pip4a.output import Output from pip4a.utils import TermFeatures, subprocess_run @@ -18,11 +19,23 @@ def test_venv( """Basic smoke test.""" # disable color for json output term_features = TermFeatures(color=False, links=False) + output = Output( + log_file="", + log_level="INFO", + log_append="false", + term_features=term_features, + verbosity=0, + ) command = ( "git clone https://github.com/ansible-collections/cisco.nxos.git" f" {tmp_path/ 'cisco.nxos'}" ) - subprocess_run(command=command, verbose=True, msg="", term_features=term_features) + subprocess_run( + command=command, + verbose=True, + msg="", + output=output, + ) monkeypatch.chdir(tmp_path) monkeypatch.setattr( @@ -67,7 +80,7 @@ def test_venv( assert "ansible.utils" not in captured_json command = f"{tmp_path / 'venv' / 'bin' / 'python'} -m pip uninstall xmltodict -y" - subprocess_run(command=command, verbose=True, msg="", term_features=term_features) + subprocess_run(command=command, verbose=True, msg="", output=output) monkeypatch.setattr("sys.argv", ["pip4a", "check", "--venv=venv"]) with pytest.raises(SystemExit): From 105c8a18deed857d34277f29789db3a945d62c8b Mon Sep 17 00:00:00 2001 From: "Bradley A. Thornton" Date: Wed, 20 Sep 2023 08:56:52 -0700 Subject: [PATCH 2/5] Allow multiple install --- src/pip4a/cli.py | 8 +++++++- src/pip4a/subcommands/uninstaller.py | 6 +++++- tests/integration/test_basic.py | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/pip4a/cli.py b/src/pip4a/cli.py index 766c8f0..ea3ff1f 100644 --- a/src/pip4a/cli.py +++ b/src/pip4a/cli.py @@ -70,13 +70,19 @@ def args_sanity(self: Cli) -> None: if ( hasattr(self.args, "collection_specifier") and len(self.args.collection_specifier) > 1 + and hasattr(self.args, "editable") and self.args.editable ): err = "Editable can only be used with a single collection specifier." self.output.critical(err) # Editable with requirements file - if hasattr(self.args, "requirement") and self.args.editable: + if ( + hasattr(self.args, "requirement") + and self.args.requirement + and hasattr(self.args, "editable") + and self.args.editable + ): err = "Editable can not be used with a requirements file." self.output.critical(err) diff --git a/src/pip4a/subcommands/uninstaller.py b/src/pip4a/subcommands/uninstaller.py index f83f4b3..f60ea23 100644 --- a/src/pip4a/subcommands/uninstaller.py +++ b/src/pip4a/subcommands/uninstaller.py @@ -32,6 +32,10 @@ def __init__(self: UnInstaller, config: Config, output: Output) -> None: def run(self: UnInstaller) -> None: """Run the uninstaller.""" + if len(self._config.args.collection_specifier) > 1: + msg = "Only one collection can be uninstalled at a time." + self._output.critical(msg) + if self._config.args.requirement: requirements_path = Path(self._config.args.requirement) if not requirements_path.exists(): @@ -47,7 +51,7 @@ def run(self: UnInstaller) -> None: self._remove_collection() else: self._collection = parse_collection_request( - string=self._config.args.collection_specifier, + string=self._config.args.collection_specifier[0], config=self._config, output=self._output, ) diff --git a/tests/integration/test_basic.py b/tests/integration/test_basic.py index 073f7c4..31ce217 100644 --- a/tests/integration/test_basic.py +++ b/tests/integration/test_basic.py @@ -20,7 +20,7 @@ def test_venv( # disable color for json output term_features = TermFeatures(color=False, links=False) output = Output( - log_file="", + log_file=f"/{tmp_path}/pip4a.log", log_level="INFO", log_append="false", term_features=term_features, From 653a2ee77cb8a5d38665fde76c9c19beba52da3c Mon Sep 17 00:00:00 2001 From: "Bradley A. Thornton" Date: Wed, 20 Sep 2023 08:59:51 -0700 Subject: [PATCH 3/5] rm trash --- 1.0 | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 1.0 diff --git a/1.0 b/1.0 deleted file mode 100644 index 2f98988..0000000 --- a/1.0 +++ /dev/null @@ -1,17 +0,0 @@ - Debug: Virtual environment: /home/bthornto/github/pip4a/venv - Debug: Virtual environment interpreter: - /home/bthornto/github/pip4a/venv/bin/python - Debug: Running command: /home/bthornto/github/pip4a/venv/bin/python -c - 'import json,site; print(json.dumps(site.getsitepackages()))' -["/home/bthornto/github/pip4a/venv/lib64/python3.11/site-packages", "/home/bthornto/github/pip4a/venv/lib/python3.11/site-packages"] - Debug: Found site packages path: - /home/bthornto/github/pip4a/venv/lib64/python3.11/site-packages - Info: Installing ansible-core. - Info: Installing collections from requirements file: - /home/bthornto/github/pip4a/requirements.yml - Debug: Removing installed /home/bthornto/github/pip4a/venv/lib64/python3.11 - /site-packages/ansible_collections/community/general - Debug: Running command: /home/bthornto/github/pip4a/venv/bin/ansible-galaxy - collection install -r /home/bthornto/github/pip4a/requirements.yml - -p /home/bthornto/github/pip4a/venv/lib64/python3.11/site-packages - --force From 6876019e965c67548f66c880fbc04256a223a87b Mon Sep 17 00:00:00 2001 From: "Bradley A. Thornton" Date: Wed, 20 Sep 2023 09:00:16 -0700 Subject: [PATCH 4/5] rm reqs --- requirements.yml | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 requirements.yml diff --git a/requirements.yml b/requirements.yml deleted file mode 100644 index 552adfe..0000000 --- a/requirements.yml +++ /dev/null @@ -1,2 +0,0 @@ -collections: - - community.general From f47c6401ba21e33b45d6f566034dba2c1a231a24 Mon Sep 17 00:00:00 2001 From: "Bradley A. Thornton" Date: Wed, 20 Sep 2023 09:06:37 -0700 Subject: [PATCH 5/5] Fix tests --- tests/unit/test_utils.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py index 3f1170b..3bb6a0d 100644 --- a/tests/unit/test_utils.py +++ b/tests/unit/test_utils.py @@ -32,7 +32,13 @@ scenarios = ( ( "ansible.utils", - Collection(config=config, cname="utils", cnamespace="ansible", local=False), + Collection( + config=config, + cname="utils", + cnamespace="ansible", + local=False, + original="ansible.utils", + ), ), ( "ansible.utils:1.0.0", @@ -42,6 +48,7 @@ cnamespace="ansible", specifier=":1.0.0", local=False, + original="ansible.utils:1.0.0", ), ), ( @@ -52,6 +59,7 @@ cnamespace="ansible", specifier=">=1.0.0", local=False, + original="ansible.utils>=1.0.0", ), ), ( @@ -63,6 +71,7 @@ local=True, path=FIXTURE_DIR, specifier=None, + original=str(FIXTURE_DIR), ), ), ( @@ -75,6 +84,7 @@ opt_deps="test", path=FIXTURE_DIR, specifier=None, + original=str(FIXTURE_DIR) + "/[test]", ), ), (