@@ -235,11 +235,13 @@ pub(crate) fn distribution_sdist_before_dependencies( |
235 | 235 | /// `pyproject.toml`, or the top level of a `uv.toml`): uv 0.2.12–0.2.27 |
236 | 236 | /// apply it when they lock without recording it in a `[[distribution]]` |
237 | 237 | /// lock, so which of a release's files that lock kept is not derivable. |
| 238 | +/// `exclude-newer-package` is not such a cutoff: those uv releases predate |
| 239 | +/// it and ignore the key, and a later uv records it in the lock. |
238 | 240 | pub(crate) fn sets_exclude_newer(settings: &dyn TableLike) -> Option<&str> { |
239 | 241 | settings |
240 | 242 | .iter() |
241 | 243 | .map(|(k, _)| k) |
242 | | - .find(|k| k.starts_with("exclude-newer")) |
| 244 | + .find(|k| k.starts_with("exclude-newer") && *k != "exclude-newer-package") |
243 | 245 | } |
244 | 246 |
|
245 | 247 | /// A uv package's install location: `source = { url | path }`, or the uv |
@@ -1264,6 +1266,22 @@ pub fn paired_metadata_path(lock: &str) -> Option<String> { |
1264 | 1266 | mod tests { |
1265 | 1267 | use super::*; |
1266 | 1268 |
|
| 1269 | + /// `exclude-newer-package` names packages (or exempts them with `false`); |
| 1270 | + /// uv 0.2 ignores it, so it is not the global cutoff that blocks a |
| 1271 | + /// `[[distribution]]` rewrite. |
| 1272 | + #[test] |
| 1273 | + fn exclude_newer_package_is_not_a_global_cutoff() { |
| 1274 | + let table = |text: &str| text.parse::<toml_edit::DocumentMut>().unwrap(); |
| 1275 | + let per_package = table("exclude-newer-package = { six = \"2024-01-01\" }\n"); |
| 1276 | + assert_eq!(sets_exclude_newer(per_package.as_table()), None); |
| 1277 | + let exempt = table("exclude-newer-package = { six = false }\n"); |
| 1278 | + assert_eq!(sets_exclude_newer(exempt.as_table()), None); |
| 1279 | + let global = table( |
| 1280 | + "exclude-newer-package = { six = false }\nexclude-newer = \"2024-01-01T00:00:00Z\"\n", |
| 1281 | + ); |
| 1282 | + assert_eq!(sets_exclude_newer(global.as_table()), Some("exclude-newer")); |
| 1283 | + } |
| 1284 | + |
1267 | 1285 | #[test] |
1268 | 1286 | fn script_locks_pair_with_their_script_and_uv_lock_with_pyproject() { |
1269 | 1287 | assert!(is_script_lock_name("tool.py.lock")); |
|