mirror of
https://github.com/actions/setup-python.git
synced 2025-04-21 22:38:43 +00:00
add fixes
This commit is contained in:
parent
b313c4cb46
commit
cb8feb63f7
4 changed files with 40 additions and 7 deletions
6
.github/workflows/e2e-cache.yml
vendored
6
.github/workflows/e2e-cache.yml
vendored
|
@ -66,15 +66,15 @@ jobs:
|
|||
- uses: actions/checkout@v3
|
||||
- name: Install poetry
|
||||
run: pipx install poetry
|
||||
- name: Init pyproject.toml
|
||||
run: mv ./__tests__/data/pyproject.toml .
|
||||
- name: Setup Python
|
||||
uses: ./
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
cache: 'poetry'
|
||||
- name: Init pyproject.toml
|
||||
run: poetry init -n
|
||||
- name: Install dependencies
|
||||
run: poetry add flake8
|
||||
run: poetry install
|
||||
|
||||
python-pip-dependencies-caching-path:
|
||||
name: Test pip (Python ${{ matrix.python-version}}, ${{ matrix.os }})
|
||||
|
|
15
__tests__/data/pyproject.toml
Normal file
15
__tests__/data/pyproject.toml
Normal file
|
@ -0,0 +1,15 @@
|
|||
[tool.poetry]
|
||||
name = "testactiontasks"
|
||||
version = "0.1.0"
|
||||
description = ""
|
||||
authors = ["Your Name <you@example.com>"]
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.8"
|
||||
flake8 = "^4.0.1"
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core>=1.0.0"]
|
||||
build-backend = "poetry.core.masonry.api"
|
13
dist/setup/index.js
vendored
13
dist/setup/index.js
vendored
|
@ -63876,8 +63876,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
const glob = __importStar(__nccwpck_require__(8090));
|
||||
const io = __importStar(__nccwpck_require__(7436));
|
||||
const path = __importStar(__nccwpck_require__(1017));
|
||||
const exec = __importStar(__nccwpck_require__(1514));
|
||||
const core = __importStar(__nccwpck_require__(2186));
|
||||
const cache_distributor_1 = __importDefault(__nccwpck_require__(8953));
|
||||
class PoetryCache extends cache_distributor_1.default {
|
||||
constructor(pythonVersion, patterns = '**/poetry.lock') {
|
||||
|
@ -63894,6 +63896,17 @@ class PoetryCache extends cache_distributor_1.default {
|
|||
if (poetryConfig['virtualenvs.in-project'] === true) {
|
||||
paths.push(path.join(process.cwd(), '.venv'));
|
||||
}
|
||||
const pythonLocation = yield io.which('python');
|
||||
if (pythonLocation) {
|
||||
core.debug(`pythonLocation is ${pythonLocation}`);
|
||||
const { exitCode, stderr } = yield exec.getExecOutput(`poetry env use ${pythonLocation}`, undefined, { ignoreReturnCode: true });
|
||||
if (exitCode) {
|
||||
core.info(`[warning]${stderr}`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
core.info('[warning]python binaries were not found in PATH.');
|
||||
}
|
||||
return paths;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -33,15 +33,20 @@ class PoetryCache extends CacheDistributor {
|
|||
|
||||
if (pythonLocation) {
|
||||
core.debug(`pythonLocation is ${pythonLocation}`);
|
||||
const {exitCode, stderr} = await exec.getExecOutput(
|
||||
`poetry env use ${pythonLocation}`
|
||||
const {
|
||||
exitCode,
|
||||
stderr
|
||||
} = await exec.getExecOutput(
|
||||
`poetry env use ${pythonLocation}`,
|
||||
undefined,
|
||||
{ignoreReturnCode: true}
|
||||
);
|
||||
|
||||
if (exitCode) {
|
||||
throw new Error(stderr);
|
||||
core.info(`[warning]${stderr}`);
|
||||
}
|
||||
} else {
|
||||
core.warning('python binaries were not found in PATH.');
|
||||
core.info('[warning]python binaries were not found in PATH.');
|
||||
}
|
||||
|
||||
return paths;
|
||||
|
|
Loading…
Add table
Reference in a new issue