3
0
Fork 0
mirror of https://gitea.com/actions/setup-python.git synced 2024-11-26 03:59:34 +01:00

Optimize code

This commit is contained in:
IvanZosimov 2022-06-30 18:42:04 +02:00
parent ccb7da8ae9
commit 099ed898be
2 changed files with 8 additions and 13 deletions

10
dist/setup/index.js vendored
View file

@ -65271,12 +65271,10 @@ function resolveVersionInput() {
} }
if (versionFile) { if (versionFile) {
if (!fs_1.default.existsSync(versionFile)) { if (!fs_1.default.existsSync(versionFile)) {
logWarning(`The specified python version file at: ${versionFile} does not exist. Attempting to find .python-version file.`); logWarning(`The specified python version file at: ${versionFile} doesn't exist. Attempting to find .python-version file.`);
if (!fs_1.default.existsSync('.python-version')) { versionFile = '.python-version';
throw new Error(`The specified python version file at: ${versionFile} does not exist and default .python-version file isn't found.`); if (!fs_1.default.existsSync(versionFile)) {
} throw new Error(`The ${versionFile} doesn't exist.`);
else {
versionFile = '.python-version';
} }
} }
version = fs_1.default.readFileSync(versionFile, 'utf8'); version = fs_1.default.readFileSync(versionFile, 'utf8');

View file

@ -39,14 +39,11 @@ function resolveVersionInput(): string {
if (versionFile) { if (versionFile) {
if (!fs.existsSync(versionFile)) { if (!fs.existsSync(versionFile)) {
logWarning( logWarning(
`The specified python version file at: ${versionFile} does not exist. Attempting to find .python-version file.` `The specified python version file at: ${versionFile} doesn't exist. Attempting to find .python-version file.`
); );
if (!fs.existsSync('.python-version')) { versionFile = '.python-version';
throw new Error( if (!fs.existsSync(versionFile)) {
`The specified python version file at: ${versionFile} does not exist and default .python-version file isn't found.` throw new Error(`The ${versionFile} doesn't exist.`);
);
} else {
versionFile = '.python-version';
} }
} }