mirror of
https://github.com/astral-sh/setup-uv.git
synced 2026-07-07 12:11:34 +00:00
Strip environment markers from detected uv dependency pins (#938)
## Summary - strip PEP 508 environment markers before extracting uv versions from dependency entries - cover dependency-group pins with and without whitespace before the marker - cover requirements-style pins with markers Fixes #920 ## Validation - npm ci --ignore-scripts - npm run all Refs: pi-session 019f316a-4108-7975-892f-ee5bf8abc7c3
This commit is contained in:
committed by
GitHub
parent
17c398959b
commit
d31148d669
@@ -63,7 +63,11 @@ function getUvVersionFromAllDependencies(
|
||||
allDependencies: string[],
|
||||
): string | undefined {
|
||||
return allDependencies
|
||||
.find((dep: string) => dep.match(/^uv[=<>~!]/))
|
||||
?.match(/^uv([=<>~!]+\S*)/)?.[1]
|
||||
.trim();
|
||||
.map(getUvVersionFromDependency)
|
||||
.find((version): version is string => version !== undefined);
|
||||
}
|
||||
|
||||
function getUvVersionFromDependency(dependency: string): string | undefined {
|
||||
const dependencyWithoutMarker = dependency.split(";", 1)[0]?.trim();
|
||||
return dependencyWithoutMarker?.match(/^uv([=<>~!]+\S*)/)?.[1].trim();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user