mirror of
https://github.com/actions/setup-python.git
synced 2026-01-20 04:38:56 +08:00
add support to install pypy
This commit is contained in:
parent
3b3f2de1b1
commit
739154f76b
7 changed files with 718 additions and 23 deletions
42
src/utils.ts
Normal file
42
src/utils.ts
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
|
||||
export const IS_WINDOWS = process.platform === 'win32';
|
||||
export const IS_LINUX = process.platform === 'linux';
|
||||
|
||||
export interface IPyPyManifestAsset {
|
||||
filename: string;
|
||||
arch: string;
|
||||
platform: string;
|
||||
download_url: string;
|
||||
}
|
||||
|
||||
export interface IPyPyManifestRelease {
|
||||
pypy_version: string;
|
||||
python_version: string;
|
||||
stable: boolean;
|
||||
latest_pypy: boolean;
|
||||
files: IPyPyManifestAsset[];
|
||||
}
|
||||
|
||||
/** create Symlinks for downloaded PyPy
|
||||
* It should be executed only for downloaded versions in runtime, because
|
||||
* toolcache versions have this setup.
|
||||
*/
|
||||
export function createSymlinkInFolder(
|
||||
folderPath: string,
|
||||
sourceName: string,
|
||||
targetName: string,
|
||||
setExecutable = false
|
||||
) {
|
||||
const sourcePath = path.join(folderPath, sourceName);
|
||||
const targetPath = path.join(folderPath, targetName);
|
||||
if (fs.existsSync(targetPath)) {
|
||||
return;
|
||||
}
|
||||
|
||||
fs.symlinkSync(sourcePath, targetPath);
|
||||
if (!IS_WINDOWS && setExecutable) {
|
||||
fs.chmodSync(targetPath, '755');
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue