Skip to content

Commit

Permalink
fix: use correct python command (#230)
Browse files Browse the repository at this point in the history
  • Loading branch information
gemaxim authored Dec 19, 2023
1 parent 53cce23 commit 393f119
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
24 changes: 17 additions & 7 deletions lib/dependencies/inspect-implementation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,14 @@ function dumpAllFilesInTempDir(tempDirName: string) {
async function updateSetuptools(
setuptoolsVersion: string,
dir: string,
pythonEnv
pythonEnv,
command: string
) {
// For python 3.12, setuptools needs to be updated
// due to removal of some deprecated packages
// see: https://github.com/pypa/pip/pull/11997

const pythonVersion = await subProcess.execute(`python`, ['--version'], {
const pythonVersion = await subProcess.execute(command, ['--version'], {
cwd: dir,
env: pythonEnv,
});
Expand All @@ -226,10 +227,14 @@ async function updateSetuptools(
return;
}

await subProcess.execute(`pip install setuptools==${setuptoolsVersion}`, [], {
cwd: dir,
env: pythonEnv,
});
await subProcess.execute(
`${command} -m pip install setuptools==${setuptoolsVersion}`,
[],
{
cwd: dir,
env: pythonEnv,
}
);
}

export async function inspectInstalledDeps(
Expand All @@ -251,7 +256,12 @@ export async function inspectInstalledDeps(
try {
const pythonEnv = getPythonEnv(targetFile);

await updateSetuptools(UPDATED_SETUPTOOLS_VERSION, root, pythonEnv);
await updateSetuptools(
UPDATED_SETUPTOOLS_VERSION,
root,
pythonEnv,
command
);

// See ../../pysrc/README.md
const output = await subProcess.execute(
Expand Down
2 changes: 1 addition & 1 deletion test/system/inspect.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ describe('inspect', () => {
{
pkg: {
name: 's3transfer',
version: '0.8.2',
version: '0.9.0',
},
directDeps: ['awss'],
},
Expand Down

0 comments on commit 393f119

Please sign in to comment.