This repository has been archived by the owner on Sep 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 238
/
Copy pathconstants.ts
61 lines (49 loc) · 1.92 KB
/
constants.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import * as inGFW from 'in-gfw';
import * as path from 'path';
import { getIsPythonInstalled } from './utils/get-is-python-installed';
const pythonMirror = process.env.npm_config_python_mirror
|| process.env.PYTHON_MIRROR
|| (inGFW.osSync() ? 'https://npm.taobao.org/mirrors/python' : 'https://www.python.org/ftp/python');
// To implement
export const IS_BUILD_TOOLS_INSTALLED = false;
export const OFFLINE_PATH = process.env.npm_config_offline_installers;
export const IS_DRY_RUN = !!process.env.npm_config_dry_run_only;
export const INSTALLED_PYTHON_VERSION = getIsPythonInstalled();
export const IS_PYTHON_INSTALLED = !!INSTALLED_PYTHON_VERSION;
export const PYTHON = process.arch === 'x64'
? {
installerName: 'python-3.8.1.amd64.msi',
installerUrl: pythonMirror.replace(/\/*$/, '/3.8.1/python-3.8.1.amd64.msi'),
targetName: 'python38',
logName: 'python-log.txt'
} : {
installerName: 'python-3.8.1.msi',
installerUrl: pythonMirror.replace(/\/*$/, '/3.8.1/python-3.8.1.msi'),
targetName: 'python38',
logName: 'python-log.txt'
};
export const BUILD_TOOLS = getBuildTools();
function getBuildTools() {
const vs2017 = {
installerName: 'vs_BuildTools.exe',
installerUrl: 'https://download.visualstudio.microsoft.com/download/pr/11503713/e64d79b40219aea618ce2fe10ebd5f0d/vs_BuildTools.exe',
logName: null,
version: 2017
};
const vs2015 = {
installerName: 'BuildTools_Full.exe',
installerUrl: 'https://download.microsoft.com/download/5/f/7/5f7acaeb-8363-451f-9425-68a90f98b238/visualcppbuildtools_full.exe',
logName: 'build-tools-log.txt',
version: 2015
};
if (process.env.npm_config_vs2017) {
return vs2017;
} else if (process.env.npm_config_vs2015) {
return vs2015;
}
// Default
return vs2017;
}
export const installerScriptPath = IS_DRY_RUN
? path.join(__dirname, '..', 'ps1', 'dry-run.ps1')
: path.join(__dirname, '..', 'ps1', 'launch-installer.ps1');