Skip to content

Commit b2472ca

Browse files
authored
fix: set python version first (#65)
* fix: set python version first Signed-off-by: Frost Ming <[email protected]> * fix: drop 3.8 and add 3.13 Signed-off-by: Frost Ming <[email protected]> * fix: update pdm.lock Signed-off-by: Frost Ming <[email protected]>
1 parent 2f3a9be commit b2472ca

File tree

6 files changed

+34
-31
lines changed

6 files changed

+34
-31
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ${{ matrix.os }}
1111
strategy:
1212
matrix:
13-
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
13+
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
1414
os: [windows-latest, ubuntu-latest, macos-latest]
1515
name: Test the action
1616
steps:

dist/setup-pdm.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -84127,7 +84127,7 @@ var import_node_process4 = __toESM(require("node:process"));
8412784127
var core8 = __toESM(require_core());
8412884128
var import_exec2 = __toESM(require_exec());
8412984129

84130-
// node_modules/.pnpm/setup-python@https+++codeload.github.com+actions+setup-python+tar.gz+2f078955e4d0f34cc7a8b0108b2eb7bbe154438e/node_modules/setup-python/src/utils.ts
84130+
// node_modules/.pnpm/github.com+actions+setup-python@2f078955e4d0f34cc7a8b0108b2eb7bbe154438e/node_modules/setup-python/src/utils.ts
8413184131
var cache = __toESM(require_cache2());
8413284132
var core = __toESM(require_core());
8413384133
var import_fs = __toESM(require("fs"));
@@ -90391,12 +90391,12 @@ var defaults = {
9039190391
var got = create_default(defaults);
9039290392
var source_default2 = got;
9039390393

90394-
// node_modules/.pnpm/setup-python@https+++codeload.github.com+actions+setup-python+tar.gz+2f078955e4d0f34cc7a8b0108b2eb7bbe154438e/node_modules/setup-python/src/find-python.ts
90394+
// node_modules/.pnpm/github.com+actions+setup-python@2f078955e4d0f34cc7a8b0108b2eb7bbe154438e/node_modules/setup-python/src/find-python.ts
9039590395
var os2 = __toESM(require("os"));
9039690396
var path3 = __toESM(require("path"));
9039790397
var semver2 = __toESM(require_semver4());
9039890398

90399-
// node_modules/.pnpm/setup-python@https+++codeload.github.com+actions+setup-python+tar.gz+2f078955e4d0f34cc7a8b0108b2eb7bbe154438e/node_modules/setup-python/src/install-python.ts
90399+
// node_modules/.pnpm/github.com+actions+setup-python@2f078955e4d0f34cc7a8b0108b2eb7bbe154438e/node_modules/setup-python/src/install-python.ts
9040090400
var path2 = __toESM(require("path"));
9040190401
var core2 = __toESM(require_core());
9040290402
var tc = __toESM(require_tool_cache());
@@ -90485,7 +90485,7 @@ async function installCpythonFromRelease(release) {
9048590485
}
9048690486
}
9048790487

90488-
// node_modules/.pnpm/setup-python@https+++codeload.github.com+actions+setup-python+tar.gz+2f078955e4d0f34cc7a8b0108b2eb7bbe154438e/node_modules/setup-python/src/find-python.ts
90488+
// node_modules/.pnpm/github.com+actions+setup-python@2f078955e4d0f34cc7a8b0108b2eb7bbe154438e/node_modules/setup-python/src/find-python.ts
9048990489
var core3 = __toESM(require_core());
9049090490
var tc2 = __toESM(require_tool_cache());
9049190491
function binDir(installDir) {
@@ -90608,10 +90608,10 @@ function pythonVersionToSemantic(versionSpec, allowPreReleases) {
9060890608
return result;
9060990609
}
9061090610

90611-
// node_modules/.pnpm/setup-python@https+++codeload.github.com+actions+setup-python+tar.gz+2f078955e4d0f34cc7a8b0108b2eb7bbe154438e/node_modules/setup-python/src/find-pypy.ts
90611+
// node_modules/.pnpm/github.com+actions+setup-python@2f078955e4d0f34cc7a8b0108b2eb7bbe154438e/node_modules/setup-python/src/find-pypy.ts
9061290612
var path5 = __toESM(require("path"));
9061390613

90614-
// node_modules/.pnpm/setup-python@https+++codeload.github.com+actions+setup-python+tar.gz+2f078955e4d0f34cc7a8b0108b2eb7bbe154438e/node_modules/setup-python/src/install-pypy.ts
90614+
// node_modules/.pnpm/github.com+actions+setup-python@2f078955e4d0f34cc7a8b0108b2eb7bbe154438e/node_modules/setup-python/src/install-pypy.ts
9061590615
var os3 = __toESM(require("os"));
9061690616
var path4 = __toESM(require("path"));
9061790617
var core4 = __toESM(require_core());
@@ -90811,7 +90811,7 @@ function replaceX32toX86(architecture) {
9081190811
return architecture;
9081290812
}
9081390813

90814-
// node_modules/.pnpm/setup-python@https+++codeload.github.com+actions+setup-python+tar.gz+2f078955e4d0f34cc7a8b0108b2eb7bbe154438e/node_modules/setup-python/src/find-pypy.ts
90814+
// node_modules/.pnpm/github.com+actions+setup-python@2f078955e4d0f34cc7a8b0108b2eb7bbe154438e/node_modules/setup-python/src/find-pypy.ts
9081590815
var semver4 = __toESM(require_semver4());
9081690816
var core5 = __toESM(require_core());
9081790817
var tc4 = __toESM(require_tool_cache());
@@ -91111,19 +91111,19 @@ async function run() {
9111191111
cmdArgs.push("--version", pdmVersion);
9111291112
cmdArgs.push("-o", "install-output.json");
9111391113
try {
91114+
const installedPython = await findPythonVersion(pythonVersion, arch2, allowPythonPreReleases, updateEnvironment);
91115+
if (import_node_process4.default.platform === "linux") {
91116+
core8.exportVariable("LD_PRELOAD", "/lib/x86_64-linux-gnu/libgcc_s.so.1");
91117+
}
9111491118
await (0, import_exec2.exec)(IS_WINDOWS ? "python" : "python3", cmdArgs, { input: await fetchUrlAsBuffer(INSTALL_SCRIPT_URL) });
9111591119
const installOutput = JSON.parse(await readFile("install-output.json"));
9111691120
core8.debug(`Install output: ${installOutput}`);
91121+
core8.info(`Successfully setup ${installOutput.pdm_version} with Python ${installedPython}`);
9111791122
core8.setOutput("pdm-version", installOutput.pdm_version);
9111891123
core8.setOutput("pdm-bin", import_node_path2.default.join(installOutput.install_location, installOutput.pdm_bin));
9111991124
core8.addPath(import_node_path2.default.dirname(installOutput.pdm_bin));
9112091125
if (core8.getBooleanInput("enable-pep582"))
9112191126
core8.exportVariable("PYTHONPATH", getPep582Path(installOutput.install_location, installOutput.install_python_version));
91122-
const installedPython = await findPythonVersion(pythonVersion, arch2, allowPythonPreReleases, updateEnvironment);
91123-
if (import_node_process4.default.platform === "linux") {
91124-
core8.exportVariable("LD_PRELOAD", "/lib/x86_64-linux-gnu/libgcc_s.so.1");
91125-
}
91126-
core8.info(`Successfully setup ${installOutput.pdm_version} with Python ${installedPython}`);
9112791127
const matchersPath = import_node_path2.default.join(__dirname, "..", ".github");
9112891128
core8.info(`##[add-matcher]${import_node_path2.default.join(matchersPath, "python.json")}`);
9112991129
if (isCacheAvailable())

pdm.lock

+7-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
name = "setup-pdm"
33
version = "0.0.0"
44
authors = [ { name = "Frost Ming", email = "[email protected]" }, ]
5-
requires-python = ">=3.8"
5+
requires-python = ">=3.9"
66
license = { text = "MIT" }
77

88
[tool.pdm]
99
distribution = false
1010

1111
[tool.pdm.dev-dependencies]
1212
dev = [
13-
"urllib3; python_version=='3.8'",
14-
"certifi; python_version=='3.9'",
15-
"pytz; python_version=='3.10'",
16-
"setuptools; python_version=='3.11'",
17-
"six; python_version=='3.12'",
13+
"certifi; python_version=='3.9'",
14+
"pytz; python_version=='3.10'",
15+
"setuptools; python_version=='3.11'",
16+
"six; python_version=='3.12'",
17+
"urllib3; python_version=='3.13'",
1818
]

src/setup-pdm.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,22 @@ async function run(): Promise<void> {
4141
cmdArgs.push('-o', 'install-output.json')
4242
// Use the default python version installed with the runner
4343
try {
44+
const installedPython = await utils.findPythonVersion(pythonVersion, arch, allowPythonPreReleases, updateEnvironment)
45+
46+
if (process.platform === 'linux') {
47+
// See https://github.com/actions/virtual-environments/issues/2803
48+
core.exportVariable('LD_PRELOAD', '/lib/x86_64-linux-gnu/libgcc_s.so.1')
49+
}
4450
await exec(IS_WINDOWS ? 'python' : 'python3', cmdArgs, { input: await utils.fetchUrlAsBuffer(INSTALL_SCRIPT_URL) })
4551
const installOutput: InstallOutput = JSON.parse(await utils.readFile('install-output.json'))
4652
core.debug(`Install output: ${installOutput}`)
53+
core.info(`Successfully setup ${installOutput.pdm_version} with Python ${installedPython}`)
4754
core.setOutput('pdm-version', installOutput.pdm_version)
4855
core.setOutput('pdm-bin', path.join(installOutput.install_location, installOutput.pdm_bin))
4956
core.addPath(path.dirname(installOutput.pdm_bin))
5057
if (core.getBooleanInput('enable-pep582'))
5158
core.exportVariable('PYTHONPATH', getPep582Path(installOutput.install_location, installOutput.install_python_version))
5259

53-
const installedPython = await utils.findPythonVersion(pythonVersion, arch, allowPythonPreReleases, updateEnvironment)
54-
55-
if (process.platform === 'linux') {
56-
// See https://github.com/actions/virtual-environments/issues/2803
57-
core.exportVariable('LD_PRELOAD', '/lib/x86_64-linux-gnu/libgcc_s.so.1')
58-
}
59-
core.info(`Successfully setup ${installOutput.pdm_version} with Python ${installedPython}`)
6060
const matchersPath = path.join(__dirname, '..', '.github')
6161
core.info(`##[add-matcher]${path.join(matchersPath, 'python.json')}`)
6262
if (utils.isCacheAvailable())

test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
import unittest
55

66
PACKAGE_MAP = {
7-
"3.8": "urllib3",
87
"3.9": "certifi",
98
"3.10": "pytz",
109
"3.11": "setuptools",
1110
"3.12": "six",
11+
"3.13": "urllib3",
1212
}
1313

1414

0 commit comments

Comments
 (0)