mirror of
https://github.com/actions/setup-python.git
synced 2026-07-18 20:45:36 +03:00
Migrate to ESM and upgrade dependencies (#1330)
* Migrate to ESM and upgrade dependencies * Add ESM migration note to README for V7 * Remove unnecessary devDependencies: ts-node, @types/jest * npm audit fix * Upgrade @types/node to version 26.0.0 * Clarify ESM migration details in README for V7 * Update README and dependencies * Fix lint issue
This commit is contained in:
+12
-7
@@ -1,18 +1,19 @@
|
||||
import * as core from '@actions/core';
|
||||
import * as finder from './find-python';
|
||||
import * as finderPyPy from './find-pypy';
|
||||
import * as finderGraalPy from './find-graalpy';
|
||||
import * as finder from './find-python.js';
|
||||
import * as finderPyPy from './find-pypy.js';
|
||||
import * as finderGraalPy from './find-graalpy.js';
|
||||
import * as path from 'path';
|
||||
import * as os from 'os';
|
||||
import {fileURLToPath} from 'url';
|
||||
import fs from 'fs';
|
||||
import {getCacheDistributor} from './cache-distributions/cache-factory';
|
||||
import {getCacheDistributor} from './cache-distributions/cache-factory.js';
|
||||
import {
|
||||
isCacheFeatureAvailable,
|
||||
logWarning,
|
||||
IS_MAC,
|
||||
getVersionInputFromFile,
|
||||
getVersionsInputFromPlainFile
|
||||
} from './utils';
|
||||
} from './utils.js';
|
||||
import {exec} from '@actions/exec';
|
||||
|
||||
function isPyPyVersion(versionSpec: string) {
|
||||
@@ -29,7 +30,7 @@ async function installPipPackages(pipInstall: string) {
|
||||
const installArgs = pipInstall.trim().split(/\s+/);
|
||||
await exec('python', ['-m', 'pip', 'install', ...installArgs]);
|
||||
core.info('Successfully installed pip packages');
|
||||
} catch (error) {
|
||||
} catch {
|
||||
core.setFailed(
|
||||
`Failed to install pip packages from "${pipInstall}". Please verify that the package names, versions, or requirements files provided are correct and installable, that the specified packages and versions can be resolved from PyPI or the configured package index, and that your network connection is stable and allows access to the package index.`
|
||||
);
|
||||
@@ -168,7 +169,11 @@ async function run() {
|
||||
'The `python-version` input is not set. The version of Python currently in `PATH` will be used.'
|
||||
);
|
||||
}
|
||||
const matchersPath = path.join(__dirname, '../..', '.github');
|
||||
const matchersPath = path.join(
|
||||
path.dirname(fileURLToPath(import.meta.url)),
|
||||
'../..',
|
||||
'.github'
|
||||
);
|
||||
core.info(`##[add-matcher]${path.join(matchersPath, 'python.json')}`);
|
||||
} catch (err) {
|
||||
core.setFailed((err as Error).message);
|
||||
|
||||
Reference in New Issue
Block a user