GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Don't treat exclude-newer-package as a uv 0.2 lock cutoff · SocketDev/socket-patch@80180b8

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • crates/socket-patch-core/src/utils
    • python_lock.rs
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎crates/socket-patch-core/src/utils/python_lock.rs‎

Copy file name to clipboardExpand all lines: crates/socket-patch-core/src/utils/python_lock.rs
+19-1Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,11 +235,13 @@ pub(crate) fn distribution_sdist_before_dependencies(
235235
/// `pyproject.toml`, or the top level of a `uv.toml`): uv 0.2.12–0.2.27
236236
/// apply it when they lock without recording it in a `[[distribution]]`
237237
/// 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.
238240
pub(crate) fn sets_exclude_newer(settings: &dyn TableLike) -> Option<&str> {
239241
settings
240242
.iter()
241243
.map(|(k, _)| k)
242-
.find(|k| k.starts_with("exclude-newer"))
244+
.find(|k| k.starts_with("exclude-newer") && *k != "exclude-newer-package")
243245
}
244246

245247
/// 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> {
12641266
mod tests {
12651267
use super::*;
12661268

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+
12671285
#[test]
12681286
fn script_locks_pair_with_their_script_and_uv_lock_with_pyproject() {
12691287
assert!(is_script_lock_name("tool.py.lock"));

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.