mirror of
https://github.com/astral-sh/setup-uv.git
synced 2025-07-27 08:11:52 +00:00
Ignore deps starting with uv when finding uv version (#492)
Fixes: #489
This commit is contained in:
committed by
GitHub
parent
05273c154d
commit
7edac99f96
@ -1 +1,2 @@
|
|||||||
|
uvicorn==0.35.0
|
||||||
uv==0.6.17
|
uv==0.6.17
|
||||||
|
10
__tests__/version/requirements-file.test.ts
Normal file
10
__tests__/version/requirements-file.test.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import { getUvVersionFromFile } from "../../src/version/resolve";
|
||||||
|
|
||||||
|
import { expect, test } from "@jest/globals";
|
||||||
|
|
||||||
|
test("ignores dependencies starting with uv", async () => {
|
||||||
|
const parsedVersion = getUvVersionFromFile(
|
||||||
|
"__tests__/fixtures/uv-in-requirements-txt-project/requirements.txt",
|
||||||
|
);
|
||||||
|
expect(parsedVersion).toBe("0.6.17");
|
||||||
|
});
|
4
dist/setup/index.js
generated
vendored
4
dist/setup/index.js
generated
vendored
@ -125802,8 +125802,8 @@ function getUvVersionFromRequirementsFile(filePath) {
|
|||||||
}
|
}
|
||||||
function getUvVersionFromAllDependencies(allDependencies) {
|
function getUvVersionFromAllDependencies(allDependencies) {
|
||||||
return allDependencies
|
return allDependencies
|
||||||
.find((dep) => dep.startsWith("uv"))
|
.find((dep) => dep.match(/^uv[=<>~!]/))
|
||||||
?.match(/^uv([^A-Z0-9._-]+.*)$/)?.[1]
|
?.match(/^uv([=<>~!]+.*)$/)?.[1]
|
||||||
.trim();
|
.trim();
|
||||||
}
|
}
|
||||||
function parsePyprojectDependencies(pyprojectContent) {
|
function parsePyprojectDependencies(pyprojectContent) {
|
||||||
|
@ -15,8 +15,8 @@ function getUvVersionFromAllDependencies(
|
|||||||
allDependencies: string[],
|
allDependencies: string[],
|
||||||
): string | undefined {
|
): string | undefined {
|
||||||
return allDependencies
|
return allDependencies
|
||||||
.find((dep: string) => dep.startsWith("uv"))
|
.find((dep: string) => dep.match(/^uv[=<>~!]/))
|
||||||
?.match(/^uv([^A-Z0-9._-]+.*)$/)?.[1]
|
?.match(/^uv([=<>~!]+.*)$/)?.[1]
|
||||||
.trim();
|
.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user