fix python path

This commit is contained in:
Frost Ming 2021-09-22 11:45:59 +08:00
parent a1d9436bad
commit 0c50f8b28d
No known key found for this signature in database
GPG Key ID: 5BFA9CB4DDA943BF
6 changed files with 46 additions and 38 deletions

View File

@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: [3.6, 3.7, 3.8, 3.9, "3.10.0.beta - 3.10.0"]
name: Test the action
steps:
- uses: actions/checkout@v2

7
dist/setup-pdm.js vendored
View File

@ -6521,17 +6521,14 @@ async function run() {
try {
let installedPython = await findPythonVersion(INSTALL_VERSION, arch2);
await exec3.exec("python", cmdArgs);
const pythonBin = import_path.default.join(process.env.pythonLocation, IS_WINDOWS ? "Scripts/python.exe" : "bin/python");
if (core3.getInput("enable-pep582") === "true") {
core3.exportVariable("PYTHONPATH", getPep582Path());
}
if (core3.getInput("python-version") !== INSTALL_VERSION) {
installedPython = await findPythonVersion(core3.getInput("python-version"), arch2);
}
await exec3.exec("pdm", [
"use",
"-f",
"python" + installedPython.version.replace(/^([23]\.\d+).*$/g, "$1")
]);
await exec3.exec("pdm", ["use", "-f", pythonBin]);
const pdmVersionOutput = (await (0, import_child_process.exec)("pdm --version")).stdout;
if (process.platform === "linux") {
core3.exportVariable("LD_PRELOAD", "/lib/x86_64-linux-gnu/libgcc_s.so.1");

56
pdm.lock generated
View File

@ -1,49 +1,53 @@
[[package]]
name = "certifi"
sections = ["dev"]
version = "2020.12.5"
marker = "python_version < '3.10' and python_version >= '3.9'"
version = "2021.5.30"
summary = "Python package for providing Mozilla's CA Bundle."
[[package]]
name = "chardet"
sections = ["dev"]
version = "3.0.4"
marker = "python_version >= '3.7' and python_version < '3.8'"
version = "4.0.0"
requires_python = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
summary = "Universal encoding detector for Python 2 and 3"
[[package]]
name = "idna"
sections = ["dev"]
version = "2.10"
marker = "python_version >= '3.6' and python_version < '3.7'"
version = "3.2"
requires_python = ">=3.5"
summary = "Internationalized Domain Names in Applications (IDNA)"
[[package]]
name = "pytz"
version = "2021.1"
summary = "World timezone definitions, modern and historical"
[[package]]
name = "urllib3"
sections = ["dev"]
version = "1.25.11"
marker = "python_version >= '3.8' and python_version < '3.9'"
version = "1.26.6"
requires_python = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4"
summary = "HTTP library with thread-safe connection pooling, file post, and more."
[metadata]
lock_version = "2"
content_hash = "sha256:8e01da7dc7329a789734e6b6c7d69eb81a13ea4c21a650e0ff23ea3c5bf25b5f"
lock_version = "3.1"
content_hash = "sha256:ac90474f1eed830cbfef586fa73d95b33b6b6c69a93b4df60a820114916f33fc"
[metadata.files]
"certifi 2020.12.5" = [
{file = "certifi-2020.12.5-py2.py3-none-any.whl", hash = "sha256:719a74fb9e33b9bd44cc7f3a8d94bc35e4049deebe19ba7d8e108280cfd59830"},
{file = "certifi-2020.12.5.tar.gz", hash = "sha256:1a4995114262bffbc2413b159f2a1a480c969de6e6eb13ee966d470af86af59c"},
"certifi 2021.5.30" = [
{file = "certifi-2021.5.30-py2.py3-none-any.whl", hash = "sha256:50b1e4f8446b06f41be7dd6338db18e0990601dce795c2b1686458aa7e8fa7d8"},
{file = "certifi-2021.5.30.tar.gz", hash = "sha256:2bbf76fd432960138b3ef6dda3dde0544f27cbf8546c458e60baf371917ba9ee"},
]
"chardet 3.0.4" = [
{file = "chardet-3.0.4-py2.py3-none-any.whl", hash = "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691"},
{file = "chardet-3.0.4.tar.gz", hash = "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae"},
"chardet 4.0.0" = [
{file = "chardet-4.0.0-py2.py3-none-any.whl", hash = "sha256:f864054d66fd9118f2e67044ac8981a54775ec5b67aed0441892edb553d21da5"},
{file = "chardet-4.0.0.tar.gz", hash = "sha256:0d6f53a15db4120f2b08c94f11e7d93d2c911ee118b6b30a04ec3ee8310179fa"},
]
"idna 2.10" = [
{file = "idna-2.10-py2.py3-none-any.whl", hash = "sha256:b97d804b1e9b523befed77c48dacec60e6dcb0b5391d57af6a65a312a90648c0"},
{file = "idna-2.10.tar.gz", hash = "sha256:b307872f855b18632ce0c21c5e45be78c0ea7ae4c15c828c20788b26921eb3f6"},
"idna 3.2" = [
{file = "idna-3.2-py3-none-any.whl", hash = "sha256:14475042e284991034cb48e06f6851428fb14c4dc953acd9be9a5e95c7b6dd7a"},
{file = "idna-3.2.tar.gz", hash = "sha256:467fbad99067910785144ce333826c71fb0e63a425657295239737f7ecd125f3"},
]
"urllib3 1.25.11" = [
{file = "urllib3-1.25.11-py2.py3-none-any.whl", hash = "sha256:f5321fbe4bf3fefa0efd0bfe7fb14e90909eb62a48ccda331726b4319897dd5e"},
{file = "urllib3-1.25.11.tar.gz", hash = "sha256:8d7eaa5a82a1cac232164990f04874c594c9453ec55eef02eab885aa02fc17a2"},
"pytz 2021.1" = [
{file = "pytz-2021.1-py2.py3-none-any.whl", hash = "sha256:eb10ce3e7736052ed3623d49975ce333bcd712c7bb19a58b9e2089d4057d0798"},
{file = "pytz-2021.1.tar.gz", hash = "sha256:83a4a90894bf38e243cf052c8b58f381bfe9a7a483f6a9cab140bc7f702ac4da"},
]
"urllib3 1.26.6" = [
{file = "urllib3-1.26.6-py2.py3-none-any.whl", hash = "sha256:39fb8672126159acb139a7718dd10806104dec1e2f0f6c88aab05d17df10c8d4"},
{file = "urllib3-1.26.6.tar.gz", hash = "sha256:f57b4c16c62fa2760b7e3d97c35b255512fb6b59a259730f36ba32ce9f8e342f"},
]

View File

@ -19,6 +19,7 @@ dev = [
"chardet; python_version=='3.7'",
"urllib3; python_version=='3.8'",
"certifi; python_version=='3.9'",
"pytz; python_version=='3.10'"
]
[build-system]

View File

@ -28,17 +28,17 @@ async function run(): Promise<void> {
try {
let installedPython = await setupPython.findPythonVersion(INSTALL_VERSION, arch)
await exec.exec("python", cmdArgs)
const pythonBin = path.join(
process.env.pythonLocation as string,
IS_WINDOWS ? "Scripts/python.exe" : "bin/python"
)
if (core.getInput("enable-pep582") === "true") {
core.exportVariable("PYTHONPATH", getPep582Path())
}
if (core.getInput("python-version") !== INSTALL_VERSION) {
installedPython = await setupPython.findPythonVersion(core.getInput("python-version"), arch)
}
await exec.exec("pdm", [
"use",
"-f",
"python" + installedPython.version.replace(/^([23]\.\d+).*$/g, "$1"),
])
await exec.exec("pdm", ["use", "-f", pythonBin])
const pdmVersionOutput = (await execChild("pdm --version")).stdout
if (process.platform === "linux") {
// See https://github.com/actions/virtual-environments/issues/2803

View File

@ -4,7 +4,13 @@ import unittest
import importlib
PACKAGE_MAP = {"3.6": "idna", "3.7": "chardet", "3.8": "urllib3", "3.9": "certifi"}
PACKAGE_MAP = {
"3.6": "idna",
"3.7": "chardet",
"3.8": "urllib3",
"3.9": "certifi",
"3.10": "pytz",
}
class TestActionSuite(unittest.TestCase):