mirror of
https://github.com/actions/setup-python.git
synced 2024-11-25 01:38:56 +00:00
Fix style issues and build
Build the project using `npm run build` and run prettier using `npm run format`
This commit is contained in:
parent
3d009a5143
commit
59a78899a9
4 changed files with 30 additions and 14 deletions
|
@ -12,15 +12,21 @@ jest.mock('@actions/core');
|
||||||
|
|
||||||
describe('parsePythonVersionFile', () => {
|
describe('parsePythonVersionFile', () => {
|
||||||
it('handle the content of a .python-version file', () => {
|
it('handle the content of a .python-version file', () => {
|
||||||
expect(parsePythonVersionFile('3.6')).toEqual('3.6')
|
expect(parsePythonVersionFile('3.6')).toEqual('3.6');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('trims extra spaces at the end of the content', () => {
|
it('trims extra spaces at the end of the content', () => {
|
||||||
expect(parsePythonVersionFile('3.7 ')).toEqual('3.7')
|
expect(parsePythonVersionFile('3.7 ')).toEqual('3.7');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('parses correctly the content of .tool-version files', () => {
|
it('parses correctly the content of .tool-version files', () => {
|
||||||
expect(parsePythonVersionFile('python 3.7')).toEqual('3.7')
|
expect(parsePythonVersionFile('python 3.7')).toEqual('3.7');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('parses correctly pypy version content of the .tool-version files', () => {
|
||||||
|
expect(parsePythonVersionFile('python pypy3.9-7.3.10')).toEqual(
|
||||||
|
'pypy3.9-7.3.10'
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -242,7 +242,7 @@ jobs:
|
||||||
The python-version-file input accepts a path to a file containing the version of Python to be used by a project, for example .python-version, or .tool-versions.
|
The python-version-file input accepts a path to a file containing the version of Python to be used by a project, for example .python-version, or .tool-versions.
|
||||||
If both the python-version and the python-version-file inputs are provided then the python-version input is used.
|
If both the python-version and the python-version-file inputs are provided then the python-version input is used.
|
||||||
|
|
||||||
> In case both `python-version` and `python-version-file` inputs are supplied, the `python-version-file` input will be ignored due to its lower priority.
|
>In case both `python-version` and `python-version-file` inputs are supplied, the `python-version-file` input will be ignored due to its lower priority.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
|
|
|
@ -65,14 +65,17 @@ export async function findPyPyVersion(
|
||||||
));
|
));
|
||||||
|
|
||||||
if (!installDir) {
|
if (!installDir) {
|
||||||
({installDir, resolvedPythonVersion, resolvedPyPyVersion} =
|
({
|
||||||
await pypyInstall.installPyPy(
|
installDir,
|
||||||
pypyVersionSpec.pypyVersion,
|
resolvedPythonVersion,
|
||||||
pypyVersionSpec.pythonVersion,
|
resolvedPyPyVersion
|
||||||
architecture,
|
} = await pypyInstall.installPyPy(
|
||||||
allowPreReleases,
|
pypyVersionSpec.pypyVersion,
|
||||||
releases
|
pypyVersionSpec.pythonVersion,
|
||||||
));
|
architecture,
|
||||||
|
allowPreReleases,
|
||||||
|
releases
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
const pipDir = IS_WINDOWS ? 'Scripts' : 'bin';
|
const pipDir = IS_WINDOWS ? 'Scripts' : 'bin';
|
||||||
|
|
|
@ -5,7 +5,12 @@ import * as path from 'path';
|
||||||
import * as os from 'os';
|
import * as os from 'os';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import {getCacheDistributor} from './cache-distributions/cache-factory';
|
import {getCacheDistributor} from './cache-distributions/cache-factory';
|
||||||
import {parsePythonVersionFile, isCacheFeatureAvailable, logWarning, IS_MAC} from './utils';
|
import {
|
||||||
|
parsePythonVersionFile,
|
||||||
|
isCacheFeatureAvailable,
|
||||||
|
logWarning,
|
||||||
|
IS_MAC
|
||||||
|
} from './utils';
|
||||||
|
|
||||||
function isPyPyVersion(versionSpec: string) {
|
function isPyPyVersion(versionSpec: string) {
|
||||||
return versionSpec.startsWith('pypy');
|
return versionSpec.startsWith('pypy');
|
||||||
|
@ -43,7 +48,9 @@ function resolveVersionInput() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const version = parsePythonVersionFile(fs.readFileSync(versionFile, 'utf8'));
|
const version = parsePythonVersionFile(
|
||||||
|
fs.readFileSync(versionFile, 'utf8')
|
||||||
|
);
|
||||||
core.info(`Resolved ${versionFile} as ${version}`);
|
core.info(`Resolved ${versionFile} as ${version}`);
|
||||||
|
|
||||||
return [version];
|
return [version];
|
||||||
|
|
Loading…
Reference in a new issue