From eba944671f5e700433105083561b4337d395e964 Mon Sep 17 00:00:00 2001 From: Wolf Vollprecht Date: Tue, 27 Feb 2024 18:08:42 +0100 Subject: [PATCH] fix: do not remove non-existing build dir (#681) --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/build.rs | 2 +- test/end-to-end/test_simple.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 47e2fd8f1..35483fb89 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2937,7 +2937,7 @@ dependencies = [ [[package]] name = "rattler-build" -version = "0.12.0" +version = "0.12.1" dependencies = [ "anyhow", "async-once-cell", diff --git a/Cargo.toml b/Cargo.toml index d0d154834..205a2b571 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ members = ["rust-tests"] [package] name = "rattler-build" -version = "0.12.0" +version = "0.12.1" authors = ["Wolf Vollprecht "] homepage = "https://github.com/prefix-dev/rattler-build" edition = "2021" diff --git a/src/build.rs b/src/build.rs index fc729c099..15798e41e 100644 --- a/src/build.rs +++ b/src/build.rs @@ -87,7 +87,7 @@ pub async fn run_build( drop(enter); - if !tool_configuration.no_clean { + if !tool_configuration.no_clean && directories.build_dir.exists() { fs::remove_dir_all(&directories.build_dir).into_diagnostic()?; } diff --git a/test/end-to-end/test_simple.py b/test/end-to-end/test_simple.py index 44a746470..c4a45cb45 100644 --- a/test/end-to-end/test_simple.py +++ b/test/end-to-end/test_simple.py @@ -207,7 +207,7 @@ def variant_hash(variant): def test_pkg_hash(rattler_build: RattlerBuild, recipes: Path, tmp_path: Path): - rattler_build.build(recipes / "pkg_hash", tmp_path) + rattler_build.build(recipes / "pkg_hash", tmp_path, extra_args=["--no-test"]) pkg = get_package(tmp_path, "pkg_hash") expected_hash = variant_hash({"target_platform": host_subdir()}) assert pkg.name.endswith(f"pkg_hash-1.0.0-{expected_hash}_my_pkg.tar.bz2")