Skip to content

Commit 1773224

Browse files
Update packse to pull in additional local version tests (#2462)
Precursor to #2430.
1 parent 2fb8df3 commit 1773224

File tree

7 files changed

+587
-34
lines changed

7 files changed

+587
-34
lines changed

crates/uv-cache/src/lib.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,19 @@ impl Cache {
257257
.write(true)
258258
.open(root.join(".git"))?;
259259

260+
// Add an empty .gitignore to the build bucket, to ensure that the cache's own .gitignore
261+
// doesn't interfere with source distribution builds. Build backends (like hatchling) will
262+
// traverse upwards to look for .gitignore files.
263+
fs::create_dir_all(root.join(CacheBucket::BuiltWheels.to_str()))?;
264+
match fs::OpenOptions::new().write(true).create_new(true).open(
265+
root.join(CacheBucket::BuiltWheels.to_str())
266+
.join(".gitignore"),
267+
) {
268+
Ok(_) => {}
269+
Err(err) if err.kind() == io::ErrorKind::AlreadyExists => (),
270+
Err(err) => return Err(err),
271+
}
272+
260273
fs::canonicalize(root)
261274
}
262275

crates/uv-distribution/src/source/mod.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,8 @@ impl<'a, T: BuildContext> SourceDistCachedBuilder<'a, T> {
816816
let span =
817817
info_span!("download_source_dist", filename = filename, source_dist = %source_dist);
818818
let temp_dir =
819-
tempfile::tempdir_in(self.build_context.cache().root()).map_err(Error::CacheWrite)?;
819+
tempfile::tempdir_in(self.build_context.cache().bucket(CacheBucket::BuiltWheels))
820+
.map_err(Error::CacheWrite)?;
820821
let reader = response
821822
.bytes_stream()
822823
.map_err(|err| std::io::Error::new(std::io::ErrorKind::Other, err))
@@ -896,8 +897,9 @@ impl<'a, T: BuildContext> SourceDistCachedBuilder<'a, T> {
896897
} else {
897898
debug!("Unpacking for build: {source_dist}");
898899

899-
let temp_dir = tempfile::tempdir_in(self.build_context.cache().root())
900-
.map_err(Error::CacheWrite)?;
900+
let temp_dir =
901+
tempfile::tempdir_in(self.build_context.cache().bucket(CacheBucket::BuiltWheels))
902+
.map_err(Error::CacheWrite)?;
901903

902904
// Unzip the archive into the temporary directory.
903905
let reader = fs_err::tokio::File::open(&path)

crates/uv/tests/pip_compile_scenarios.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! DO NOT EDIT
22
//!
33
//! Generated with ./scripts/scenarios/sync.sh
4-
//! Scenarios from <https://github.com/zanieb/packse/tree/0.3.7/scenarios>
4+
//! Scenarios from <https://github.com/zanieb/packse/tree/0.3.9/scenarios>
55
//!
66
#![cfg(all(feature = "python", feature = "pypi"))]
77

@@ -27,9 +27,9 @@ fn command(context: &TestContext, python_versions: &[&str]) -> Command {
2727
.arg("compile")
2828
.arg("requirements.in")
2929
.arg("--index-url")
30-
.arg("https://astral-sh.github.io/packse/0.3.7/simple-html/")
30+
.arg("https://astral-sh.github.io/packse/0.3.9/simple-html/")
3131
.arg("--find-links")
32-
.arg("https://raw.githubusercontent.com/zanieb/packse/0.3.7/vendor/links.html")
32+
.arg("https://raw.githubusercontent.com/zanieb/packse/0.3.9/vendor/links.html")
3333
.arg("--cache-dir")
3434
.arg(context.cache_dir.path())
3535
.env("VIRTUAL_ENV", context.venv.as_os_str())
@@ -66,7 +66,7 @@ fn incompatible_python_compatible_override() -> Result<()> {
6666
let context = TestContext::new("3.9");
6767
let python_versions = &[];
6868

69-
// In addition to the standard filters, swap out package names for more realistic messages
69+
// In addition to the standard filters, swap out package names for shorter messages
7070
let mut filters = INSTA_FILTERS.to_vec();
7171
filters.push((r"incompatible-python-compatible-override-", "package-"));
7272

@@ -115,7 +115,7 @@ fn compatible_python_incompatible_override() -> Result<()> {
115115
let context = TestContext::new("3.11");
116116
let python_versions = &[];
117117

118-
// In addition to the standard filters, swap out package names for more realistic messages
118+
// In addition to the standard filters, swap out package names for shorter messages
119119
let mut filters = INSTA_FILTERS.to_vec();
120120
filters.push((r"compatible-python-incompatible-override-", "package-"));
121121

@@ -162,7 +162,7 @@ fn incompatible_python_compatible_override_unavailable_no_wheels() -> Result<()>
162162
let context = TestContext::new("3.9");
163163
let python_versions = &[];
164164

165-
// In addition to the standard filters, swap out package names for more realistic messages
165+
// In addition to the standard filters, swap out package names for shorter messages
166166
let mut filters = INSTA_FILTERS.to_vec();
167167
filters.push((
168168
r"incompatible-python-compatible-override-unavailable-no-wheels-",
@@ -218,7 +218,7 @@ fn incompatible_python_compatible_override_available_no_wheels() -> Result<()> {
218218
let context = TestContext::new("3.9");
219219
let python_versions = &["3.11"];
220220

221-
// In addition to the standard filters, swap out package names for more realistic messages
221+
// In addition to the standard filters, swap out package names for shorter messages
222222
let mut filters = INSTA_FILTERS.to_vec();
223223
filters.push((
224224
r"incompatible-python-compatible-override-available-no-wheels-",
@@ -273,7 +273,7 @@ fn incompatible_python_compatible_override_no_compatible_wheels() -> Result<()>
273273
let context = TestContext::new("3.9");
274274
let python_versions = &[];
275275

276-
// In addition to the standard filters, swap out package names for more realistic messages
276+
// In addition to the standard filters, swap out package names for shorter messages
277277
let mut filters = INSTA_FILTERS.to_vec();
278278
filters.push((
279279
r"incompatible-python-compatible-override-no-compatible-wheels-",
@@ -331,7 +331,7 @@ fn incompatible_python_compatible_override_other_wheel() -> Result<()> {
331331
let context = TestContext::new("3.9");
332332
let python_versions = &[];
333333

334-
// In addition to the standard filters, swap out package names for more realistic messages
334+
// In addition to the standard filters, swap out package names for shorter messages
335335
let mut filters = INSTA_FILTERS.to_vec();
336336
filters.push((
337337
r"incompatible-python-compatible-override-other-wheel-",
@@ -391,7 +391,7 @@ fn python_patch_override_no_patch() -> Result<()> {
391391
let context = TestContext::new("3.8.18");
392392
let python_versions = &[];
393393

394-
// In addition to the standard filters, swap out package names for more realistic messages
394+
// In addition to the standard filters, swap out package names for shorter messages
395395
let mut filters = INSTA_FILTERS.to_vec();
396396
filters.push((r"python-patch-override-no-patch-", "package-"));
397397

@@ -438,7 +438,7 @@ fn python_patch_override_patch_compatible() -> Result<()> {
438438
let context = TestContext::new("3.8.18");
439439
let python_versions = &[];
440440

441-
// In addition to the standard filters, swap out package names for more realistic messages
441+
// In addition to the standard filters, swap out package names for shorter messages
442442
let mut filters = INSTA_FILTERS.to_vec();
443443
filters.push((r"python-patch-override-patch-compatible-", "package-"));
444444

0 commit comments

Comments
 (0)