Skip to content

Commit

Permalink
krakenw: Fix using default installer and no longer show warning of co…
Browse files Browse the repository at this point in the history
…rrupted Venv when there's none at all (#200)

* fix: Fix warning about corrupt virtual environment also showing when there is no trace of any prior virtual environment

* fix: Fix using the default installer as configured with `krakenw config --installer=...`
  • Loading branch information
NiklasRosenstein authored Feb 16, 2024
1 parent edeffd0 commit e1a498c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
13 changes: 13 additions & 0 deletions .changelog/_unreleased.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[[entries]]
id = "e663a548-2495-475d-abf9-62a0b7d0d00b"
type = "fix"
description = "Fix warning about corrupt virtual environment also showing when there is no trace of any prior virtual environment"
author = "@NiklasRosenstein"
component = "kraken-wrapper"

[[entries]]
id = "daf69f05-c069-4172-9ef3-10219a926f53"
type = "fix"
description = "Fix using the default installer as configured with `krakenw config --installer=...`"
author = "@NiklasRosenstein"
component = "kraken-wrapper"
2 changes: 1 addition & 1 deletion kraken-wrapper/src/kraken/wrapper/_buildenv_venv.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def build(self, requirements: RequirementSpec, transitive: bool) -> None:
)
safe_rmpath(self._path)

elif not success_flag.is_file():
elif self._venv.exists() and not success_flag.is_file():
logger.warning("Your virtual build environment appears to be corrupt. It will be recreated. This happens")
logger.warning("by pressing Ctrl+C during its installation, or if you've recently upgraded kraken-wrapper.")
safe_rmpath(self._path)
Expand Down
6 changes: 3 additions & 3 deletions kraken-wrapper/src/kraken/wrapper/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,6 @@ def _ensure_installed(
project: Project,
reinstall: bool,
upgrade: bool,
default_installer: EnvironmentType,
env_type: EnvironmentType | None = None,
) -> None:
exists = manager.exists()
Expand Down Expand Up @@ -332,11 +331,12 @@ def _ensure_installed(

env_type = env_type or manager.get_environment().get_type()
logger.info(
"%s build environment from %s (%s)%s",
"%s build environment from %s (%s)%s using installer %s.",
operation,
source_name,
os.path.relpath(source_file),
f" ({reason})" if reason else "",
env_type.name,
)

tstart = time.perf_counter()
Expand Down Expand Up @@ -449,6 +449,7 @@ def main() -> NoReturn:
AuthModel(config_file, DEFAULT_CONFIG_PATH, use_keyring_if_available=not env_options.no_keyring),
incremental=env_options.incremental,
show_install_logs=env_options.show_install_logs,
default_type=config.get_default_installer(),
)

# Execute environment operations before delegating the command.
Expand All @@ -474,7 +475,6 @@ def main() -> NoReturn:
project,
env_options.reinstall,
env_options.upgrade,
config.get_default_installer(),
env_options.use,
)

Expand Down

0 comments on commit e1a498c

Please sign in to comment.