Skip to content

Commit

Permalink
fix: set python version first (#65)
Browse files Browse the repository at this point in the history
* fix: set python version first

Signed-off-by: Frost Ming <me@frostming.com>

* fix: drop 3.8 and add 3.13

Signed-off-by: Frost Ming <me@frostming.com>

* fix: update pdm.lock

Signed-off-by: Frost Ming <me@frostming.com>
  • Loading branch information
frostming authored Nov 28, 2024
1 parent 2f3a9be commit b2472ca
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
os: [windows-latest, ubuntu-latest, macos-latest]
name: Test the action
steps:
Expand Down
24 changes: 12 additions & 12 deletions dist/setup-pdm.js
Original file line number Diff line number Diff line change
Expand Up @@ -84127,7 +84127,7 @@ var import_node_process4 = __toESM(require("node:process"));
var core8 = __toESM(require_core());
var import_exec2 = __toESM(require_exec());

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

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

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

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

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

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

// node_modules/.pnpm/setup-python@https+++codeload.github.com+actions+setup-python+tar.gz+2f078955e4d0f34cc7a8b0108b2eb7bbe154438e/node_modules/setup-python/src/find-pypy.ts
// node_modules/.pnpm/github.com+actions+setup-python@2f078955e4d0f34cc7a8b0108b2eb7bbe154438e/node_modules/setup-python/src/find-pypy.ts
var semver4 = __toESM(require_semver4());
var core5 = __toESM(require_core());
var tc4 = __toESM(require_tool_cache());
Expand Down Expand Up @@ -91111,19 +91111,19 @@ async function run() {
cmdArgs.push("--version", pdmVersion);
cmdArgs.push("-o", "install-output.json");
try {
const installedPython = await findPythonVersion(pythonVersion, arch2, allowPythonPreReleases, updateEnvironment);
if (import_node_process4.default.platform === "linux") {
core8.exportVariable("LD_PRELOAD", "/lib/x86_64-linux-gnu/libgcc_s.so.1");
}
await (0, import_exec2.exec)(IS_WINDOWS ? "python" : "python3", cmdArgs, { input: await fetchUrlAsBuffer(INSTALL_SCRIPT_URL) });
const installOutput = JSON.parse(await readFile("install-output.json"));
core8.debug(`Install output: ${installOutput}`);
core8.info(`Successfully setup ${installOutput.pdm_version} with Python ${installedPython}`);
core8.setOutput("pdm-version", installOutput.pdm_version);
core8.setOutput("pdm-bin", import_node_path2.default.join(installOutput.install_location, installOutput.pdm_bin));
core8.addPath(import_node_path2.default.dirname(installOutput.pdm_bin));
if (core8.getBooleanInput("enable-pep582"))
core8.exportVariable("PYTHONPATH", getPep582Path(installOutput.install_location, installOutput.install_python_version));
const installedPython = await findPythonVersion(pythonVersion, arch2, allowPythonPreReleases, updateEnvironment);
if (import_node_process4.default.platform === "linux") {
core8.exportVariable("LD_PRELOAD", "/lib/x86_64-linux-gnu/libgcc_s.so.1");
}
core8.info(`Successfully setup ${installOutput.pdm_version} with Python ${installedPython}`);
const matchersPath = import_node_path2.default.join(__dirname, "..", ".github");
core8.info(`##[add-matcher]${import_node_path2.default.join(matchersPath, "python.json")}`);
if (isCacheAvailable())
Expand Down
11 changes: 7 additions & 4 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
name = "setup-pdm"
version = "0.0.0"
authors = [ { name = "Frost Ming", email = "mianghong@gmail.com" }, ]
requires-python = ">=3.8"
requires-python = ">=3.9"
license = { text = "MIT" }

[tool.pdm]
distribution = false

[tool.pdm.dev-dependencies]
dev = [
"urllib3; python_version=='3.8'",
"certifi; python_version=='3.9'",
"pytz; python_version=='3.10'",
"setuptools; python_version=='3.11'",
"six; python_version=='3.12'",
"certifi; python_version=='3.9'",
"pytz; python_version=='3.10'",
"setuptools; python_version=='3.11'",
"six; python_version=='3.12'",
"urllib3; python_version=='3.13'",
]
14 changes: 7 additions & 7 deletions src/setup-pdm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,22 @@ async function run(): Promise<void> {
cmdArgs.push('-o', 'install-output.json')
// Use the default python version installed with the runner
try {
const installedPython = await utils.findPythonVersion(pythonVersion, arch, allowPythonPreReleases, updateEnvironment)

if (process.platform === 'linux') {
// See https://github.com/actions/virtual-environments/issues/2803
core.exportVariable('LD_PRELOAD', '/lib/x86_64-linux-gnu/libgcc_s.so.1')
}
await exec(IS_WINDOWS ? 'python' : 'python3', cmdArgs, { input: await utils.fetchUrlAsBuffer(INSTALL_SCRIPT_URL) })
const installOutput: InstallOutput = JSON.parse(await utils.readFile('install-output.json'))
core.debug(`Install output: ${installOutput}`)
core.info(`Successfully setup ${installOutput.pdm_version} with Python ${installedPython}`)
core.setOutput('pdm-version', installOutput.pdm_version)
core.setOutput('pdm-bin', path.join(installOutput.install_location, installOutput.pdm_bin))
core.addPath(path.dirname(installOutput.pdm_bin))
if (core.getBooleanInput('enable-pep582'))
core.exportVariable('PYTHONPATH', getPep582Path(installOutput.install_location, installOutput.install_python_version))

const installedPython = await utils.findPythonVersion(pythonVersion, arch, allowPythonPreReleases, updateEnvironment)

if (process.platform === 'linux') {
// See https://github.com/actions/virtual-environments/issues/2803
core.exportVariable('LD_PRELOAD', '/lib/x86_64-linux-gnu/libgcc_s.so.1')
}
core.info(`Successfully setup ${installOutput.pdm_version} with Python ${installedPython}`)
const matchersPath = path.join(__dirname, '..', '.github')
core.info(`##[add-matcher]${path.join(matchersPath, 'python.json')}`)
if (utils.isCacheAvailable())
Expand Down
2 changes: 1 addition & 1 deletion test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
import unittest

PACKAGE_MAP = {
"3.8": "urllib3",
"3.9": "certifi",
"3.10": "pytz",
"3.11": "setuptools",
"3.12": "six",
"3.13": "urllib3",
}


Expand Down

0 comments on commit b2472ca

Please sign in to comment.