Skip to content

Commit

Permalink
Do not execute uv sync for every python project. Fixes #1532
Browse files Browse the repository at this point in the history
Signed-off-by: Prabhu Subramanian <[email protected]>
  • Loading branch information
prabhu committed Jan 6, 2025
1 parent 90bd2fc commit 5de8589
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 11 deletions.
1 change: 1 addition & 0 deletions .github/workflows/snapshot-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ jobs:
- name: Run scripts
env:
PREFER_MAVEN_DEPS_TREE: false
ATOM_JAVA_HOME: /usr/lib/jvm/java-21-openjdk-amd64
run: |
bash new_snapshots/cdxgen_commands.sh
Expand Down
11 changes: 1 addition & 10 deletions lib/cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3013,16 +3013,7 @@ export async function createPythonBom(path, options) {
delete parentComponent.repository;
}
// Is this a uv project without a lock file?
if (
options.installDeps &&
(pyProjMap.uvMode ||
isPackageManagerAllowed(
"uv",
["pip", "poetry", "hatch", "pdm"],
options,
)) &&
!uvLockFiles.length
) {
if (options.installDeps && pyProjMap.uvMode && !uvLockFiles.length) {
createUVLock(path, options);
uvLockFiles = getAllFiles(
path,
Expand Down
19 changes: 19 additions & 0 deletions lib/helpers/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
getRepoLicense,
guessPypiMatchingVersion,
hasAnyProjectType,
isPackageManagerAllowed,
isPartialTree,
isValidIriReference,
mapConanPkgRefToPurlStringAndNameAndVersion,
Expand Down Expand Up @@ -5732,3 +5733,21 @@ test("hasAnyProjectType tests", () => {
),
).toBeFalsy();
});

test("isPackageManagerAllowed tests", () => {
expect(
isPackageManagerAllowed("uv", ["pip", "poetry", "hatch", "pdm"], {
projectType: undefined,
}),
).toBeTruthy();
expect(
isPackageManagerAllowed("uv", ["pip", "poetry", "hatch", "pdm"], {
projectType: ["python"],
}),
).toBeTruthy();
expect(
isPackageManagerAllowed("uv", ["pip", "poetry", "hatch", "pdm"], {
projectType: ["pip"],
}),
).toBeFalsy();
});
2 changes: 1 addition & 1 deletion types/lib/cli/index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5de8589

Please sign in to comment.