mirror of
https://github.com/actions/setup-python.git
synced 2025-07-22 11:08:21 +02:00
fix poetry python version
This commit is contained in:
parent
ae11205ec6
commit
70f6f2a532
3 changed files with 37 additions and 1 deletions
|
@ -1,7 +1,8 @@
|
|||
import * as glob from '@actions/glob';
|
||||
import * as os from 'os';
|
||||
import * as io from '@actions/io';
|
||||
import * as path from 'path';
|
||||
import * as exec from '@actions/exec';
|
||||
import * as core from '@actions/core';
|
||||
|
||||
import CacheDistributor from './cache-distributor';
|
||||
|
||||
|
@ -28,6 +29,21 @@ class PoetryCache extends CacheDistributor {
|
|||
paths.push(path.join(process.cwd(), '.venv'));
|
||||
}
|
||||
|
||||
const pythonLocation = await io.which('python');
|
||||
|
||||
if (pythonLocation) {
|
||||
core.debug(`pythonLocation is ${pythonLocation}`);
|
||||
const {exitCode, stderr} = await exec.getExecOutput(
|
||||
`poetry env use ${pythonLocation}`
|
||||
);
|
||||
|
||||
if (exitCode) {
|
||||
throw new Error(stderr);
|
||||
}
|
||||
} else {
|
||||
core.warning('python binaries were not found in PATH.');
|
||||
}
|
||||
|
||||
return paths;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue