From 3940ff5e677b8f9bcee016bd8fbfeaf6abaf19ba Mon Sep 17 00:00:00 2001 From: "Bradley A. Thornton" Date: Tue, 19 Sep 2023 08:32:34 -0700 Subject: [PATCH] Fix installation and editable --- src/pip4a/subcommands/installer.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/pip4a/subcommands/installer.py b/src/pip4a/subcommands/installer.py index b26b09d..c4799aa 100644 --- a/src/pip4a/subcommands/installer.py +++ b/src/pip4a/subcommands/installer.py @@ -41,10 +41,6 @@ def __init__(self: Installer, config: Config, output: Output) -> None: def run(self: Installer) -> None: """Run the installer.""" - if self._config.args.editable and not self._collection.local: - err = "Editable installs are only supported for local collections." - self._output.critical(err) - if ( self._config.args.collection_specifier and "," in self._config.args.collection_specifier @@ -67,6 +63,9 @@ def run(self: Installer) -> None: if self._config.args.editable: self._swap_editable_collection() elif not self._collection.local: + if self._config.args.editable: + msg = "Editable installs are only supported for local collections." + self._output.critical(msg) self._install_galaxy_collection() builder_introspect(config=self._config) @@ -296,11 +295,11 @@ def _install_local_collection(self: Installer) -> None: # noqa: PLR0912, PLR091 if not self._config.args.editable: shutil.copy( self._collection.build_dir / "galaxy.yml", - self._config.site_pkg_path / "galaxy.yml", + self._collection.site_pkg_path / "galaxy.yml", ) else: shutil.copy( - self._config.site_pkg_path / "MANIFEST.json", + self._collection.site_pkg_path / "MANIFEST.json", self._collection.cache_dir / "MANIFEST.json", ) @@ -320,13 +319,13 @@ def _swap_editable_collection(self: Installer) -> None: if self._collection.path is None: msg = "Collection path not set" raise RuntimeError(msg) - msg = f"Removing installed {self._config.site_pkg_path}" + msg = f"Removing installed {self._collection.site_pkg_path}" self._output.debug(msg) - if self._config.site_pkg_path.exists(): - if self._config.site_pkg_path.is_symlink(): - self._config.site_pkg_path.unlink() + if self._collection.site_pkg_path.exists(): + if self._collection.site_pkg_path.is_symlink(): + self._collection.site_pkg_path.unlink() else: - shutil.rmtree(self._config.site_pkg_path) + shutil.rmtree(self._collection.site_pkg_path) msg = f"Symlinking {self._collection.site_pkg_path} to {self._collection.path}" self._output.debug(msg)