pinokiod 3.3.39 → 3.3.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/kernel/bin/conda.js +2 -0
- package/kernel/bin/vs.js +55 -191
- package/package.json +1 -1
package/kernel/bin/conda.js
CHANGED
|
@@ -41,6 +41,8 @@ class Conda {
|
|
|
41
41
|
let base = {
|
|
42
42
|
// CONDA_ROOT: this.kernel.bin.path("miniconda"),
|
|
43
43
|
CONDA_PREFIX: this.kernel.bin.path("miniconda"),
|
|
44
|
+
CONDA_ENVS_PATH: this.kernel.bin.path("miniconda/envs"),
|
|
45
|
+
CONDA_PKGS_DIRS: this.kernel.bin.path("miniconda/pkgs"),
|
|
44
46
|
PYTHON: this.kernel.bin.path("miniconda/python"),
|
|
45
47
|
PATH: this.paths[this.kernel.platform].map((p) => {
|
|
46
48
|
return this.kernel.bin.path(p)
|
package/kernel/bin/vs.js
CHANGED
|
@@ -5,41 +5,38 @@ const { glob } = require('glob')
|
|
|
5
5
|
class VS {
|
|
6
6
|
description = "Look for a dialog requesting admin permission and approve it to proceed. This will install Microsoft visual studio build tools, which is required for building several python wheels."
|
|
7
7
|
async install(req, ondata) {
|
|
8
|
-
|
|
9
|
-
|
|
10
8
|
// 3. Run installer
|
|
11
9
|
if (os.release().startsWith("10")) {
|
|
12
|
-
|
|
13
10
|
// Download installer
|
|
14
11
|
const installer_url = "https://github.com/cocktailpeanut/bin/releases/download/vs_buildtools/vs_buildtools.exe"
|
|
15
12
|
const installer = "vs_buildtools.exe"
|
|
16
|
-
ondata({ raw: `[1] downloading installer: ${installer_url}...\r\n
|
|
13
|
+
ondata({ raw: `[1] downloading installer: ${installer_url}...\r\n` })
|
|
17
14
|
await this.kernel.bin.download(installer_url, installer, ondata)
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
ondata({ raw: `[2] Installing..\r\n` })
|
|
16
|
+
let commands = [
|
|
17
|
+
this.cmd("uninstall"),
|
|
18
|
+
this.cmd("install"),
|
|
19
|
+
this.cmd("repair")
|
|
20
|
+
]
|
|
21
|
+
let cmd = commands.join(" && ")
|
|
24
22
|
await this.kernel.bin.exec({ sudo: true, message: cmd, }, (stream) => {
|
|
25
23
|
ondata(stream)
|
|
26
24
|
})
|
|
27
|
-
ondata({ raw: `[4] updating...\r\n\r\n` })
|
|
28
|
-
const cmd2 = this.cmd("update")
|
|
29
|
-
await this.kernel.bin.exec({ sudo: true, message: cmd2, }, (stream) => {
|
|
30
|
-
ondata(stream)
|
|
31
|
-
})
|
|
32
25
|
ondata({ raw: `Install finished\r\n\r\n` })
|
|
26
|
+
let WARNING = "[NOTICE] If this step keeps repeating, try opening the 'Visual Studio Installer' app on Windows, and check if there are failed installations, and uninstall them and retry."
|
|
27
|
+
ondata({
|
|
28
|
+
raw: `\r\n\x1b[33m${WARNING}\x1b[0m\r\n\r\n`
|
|
29
|
+
})
|
|
33
30
|
return this.kernel.bin.rm(installer, ondata)
|
|
34
31
|
} else {
|
|
35
32
|
ondata({ raw: `Must be Windows 10 or above\r\n` })
|
|
36
33
|
}
|
|
37
34
|
}
|
|
38
35
|
async getpaths() {
|
|
39
|
-
let MSVC_PATH
|
|
40
|
-
let BUILD_PATH
|
|
41
|
-
let CMAKE_PATH
|
|
42
|
-
let CL_PATH
|
|
36
|
+
let MSVC_PATH = []
|
|
37
|
+
let BUILD_PATH = []
|
|
38
|
+
let CMAKE_PATH = []
|
|
39
|
+
let CL_PATH = []
|
|
43
40
|
const program_file_paths = [process.env["ProgramFiles(x86)"], process.env["ProgramFiles"]]
|
|
44
41
|
for(let rp of program_file_paths) {
|
|
45
42
|
const ROOT_PATH = path.resolve(rp, "Microsoft Visual Studio")
|
|
@@ -47,71 +44,41 @@ class VS {
|
|
|
47
44
|
const e1 = await this.kernel.bin.exists(ROOT_PATH)
|
|
48
45
|
if (e1) {
|
|
49
46
|
console.log("exists", ROOT_PATH)
|
|
50
|
-
|
|
51
|
-
if (
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
console.log({ MSVC_PATH })
|
|
57
|
-
BUILD_PATH = await glob('**/VC/Auxiliary/Build', { absolute: true, cwd: ROOT_PATH })
|
|
58
|
-
if (BUILD_PATH && BUILD_PATH.length > 0) {
|
|
59
|
-
BUILD_PATH = BUILD_PATH.filter((x) => {
|
|
60
|
-
return /.*2019.*/.test(x)
|
|
61
|
-
})
|
|
47
|
+
let vcpaths = await glob('**/VC/Tools/MSVC', { absolute: true, cwd: ROOT_PATH })
|
|
48
|
+
if (vcpaths && vcpaths > 0) {
|
|
49
|
+
for(let vcpath of vcpaths) {
|
|
50
|
+
if (/.*2019.*/.test(vcpath)) {
|
|
51
|
+
MSVC_PATH.push(vcpath)
|
|
52
|
+
}
|
|
62
53
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
54
|
+
}
|
|
55
|
+
let buildpaths = await glob('**/VC/Auxiliary/Build', { absolute: true, cwd: ROOT_PATH })
|
|
56
|
+
if (buildpaths && buildpaths.length > 0) {
|
|
57
|
+
for(let buildpath of buildpaths) {
|
|
58
|
+
if (/.*2019.*/.test(buildpath)) {
|
|
59
|
+
BUILD_PATH.push(buildpath)
|
|
60
|
+
}
|
|
69
61
|
}
|
|
70
|
-
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
let cmakepaths = await glob('**/Microsoft/CMake/CMake/bin', { absolute: true, cwd: ROOT_PATH })
|
|
65
|
+
if (cmakepaths && cmakepaths.length > 0) {
|
|
66
|
+
for(let cmakepath of cmakepaths) {
|
|
67
|
+
if (/.*2019.*/.test(cmakepath)) {
|
|
68
|
+
CMAKE_PATH.push(cmakepath)
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
71
72
|
//CL_PATH = await glob('**/Hostx64/x64/cl.exe', { absolute: true, cwd: ROOT_PATH })
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
let clpaths = await glob('**/Hostx64/x64', { absolute: true, cwd: ROOT_PATH })
|
|
74
|
+
if (clpaths && clpaths.length > 0) {
|
|
75
|
+
for(let clpath of clpaths) {
|
|
76
|
+
if (/.*2019.*/.test(clpath)) {
|
|
77
|
+
CL_PATH.push(clpath)
|
|
78
|
+
}
|
|
77
79
|
}
|
|
78
|
-
console.log({ CL_PATH })
|
|
79
|
-
break;
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
/*
|
|
85
|
-
Example:
|
|
86
|
-
{
|
|
87
|
-
ROOT_PATH: "C:\Program Files (x86)\Microsoft Visual Studio"
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
MSVC_PATH: [
|
|
91
|
-
'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC',
|
|
92
|
-
'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC'
|
|
93
|
-
]
|
|
94
|
-
}
|
|
95
|
-
{
|
|
96
|
-
BUILD_PATH: [
|
|
97
|
-
'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Auxiliary\\Build',
|
|
98
|
-
'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Auxiliary\\Build'
|
|
99
|
-
]
|
|
100
|
-
}
|
|
101
|
-
{
|
|
102
|
-
CMAKE_PATH: [
|
|
103
|
-
'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\Common7\\IDE\\CommonExtensions\\Microsoft\\CMake\\CMake\\bin',
|
|
104
|
-
'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\Common7\\IDE\\CommonExtensions\\Microsoft\\CMake\\CMake\\bin'
|
|
105
|
-
]
|
|
106
|
-
}
|
|
107
|
-
{
|
|
108
|
-
CL_PATH: [
|
|
109
|
-
'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30133\\bin\\Hostx64\\x64',
|
|
110
|
-
'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.42.34433\\bin\\Hostx64\\x64'
|
|
111
|
-
]
|
|
112
|
-
}
|
|
113
|
-
*/
|
|
114
|
-
|
|
115
82
|
}
|
|
116
83
|
console.log({ MSVC_PATH, BUILD_PATH, CMAKE_PATH, CL_PATH })
|
|
117
84
|
return {
|
|
@@ -123,78 +90,8 @@ class VS {
|
|
|
123
90
|
}
|
|
124
91
|
|
|
125
92
|
}
|
|
126
|
-
// async getpaths() {
|
|
127
|
-
// const ROOT_PATH = process.env["ProgramFiles(x86)"] || process.env["ProgramFiles"]
|
|
128
|
-
//
|
|
129
|
-
// const MSVC_2019_PATH = path.resolve(ROOT_PATH, "Microsoft Visual Studio", "2019", "BuildTools/VC/Tools/MSVC")
|
|
130
|
-
// const MSVC_2022_PATH = path.resolve(ROOT_PATH, "Microsoft Visual Studio", "2022", "BuildTools/VC/Tools/MSVC")
|
|
131
|
-
// const e1 = await this.kernel.bin.exists(MSVC_2019_PATH)
|
|
132
|
-
// const e2 = await this.kernel.bin.exists(MSVC_2022_PATH)
|
|
133
|
-
// let MSVC_PATH
|
|
134
|
-
// if (e1) {
|
|
135
|
-
// MSVC_PATH = MSVC_2019_PATH
|
|
136
|
-
// } else if (e2) {
|
|
137
|
-
// MSVC_PATH = MSVC_2022_PATH
|
|
138
|
-
// }
|
|
139
|
-
//
|
|
140
|
-
// const BUILD_2019_PATH = path.resolve(ROOT_PATH, "Microsoft Visual Studio", "2019", "BuildTools/VC/Auxiliary/Build")
|
|
141
|
-
// const BUILD_2022_PATH = path.resolve(ROOT_PATH, "Microsoft Visual Studio", "2022", "BuildTools/VC/Auxiliary/Build")
|
|
142
|
-
// const e3 = await this.kernel.bin.exists(BUILD_2019_PATH)
|
|
143
|
-
// const e4 = await this.kernel.bin.exists(BUILD_2022_PATH)
|
|
144
|
-
// let BUILD_PATH
|
|
145
|
-
// if (e3) {
|
|
146
|
-
// BUILD_PATH = BUILD_2019_PATH
|
|
147
|
-
// } else if (e4) {
|
|
148
|
-
// BUILD_PATH = BUILD_2022_PATH
|
|
149
|
-
// }
|
|
150
|
-
//
|
|
151
|
-
// const CMAKE_2019_PATH = path.resolve(ROOT_PATH, "Microsoft Visual Studio", "2019", "BuildTools/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/bin")
|
|
152
|
-
// const CMAKE_2022_PATH = path.resolve(ROOT_PATH, "Microsoft Visual Studio", "2022", "BuildTools/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/bin")
|
|
153
|
-
// const e5 = await this.kernel.bin.exists(CMAKE_2019_PATH)
|
|
154
|
-
// const e6 = await this.kernel.bin.exists(CMAKE_2022_PATH)
|
|
155
|
-
// let CMAKE_PATH
|
|
156
|
-
// if (e5) {
|
|
157
|
-
// CMAKE_PATH = CMAKE_2019_PATH
|
|
158
|
-
// } else if (e6) {
|
|
159
|
-
// CMAKE_PATH = CMAKE_2022_PATH
|
|
160
|
-
// }
|
|
161
|
-
//
|
|
162
|
-
// console.log({
|
|
163
|
-
// e1, e2, e3, e4, e5, e6,
|
|
164
|
-
// ROOT_PATH,
|
|
165
|
-
// MSVC_2019_PATH, MSVC_2022_PATH,
|
|
166
|
-
// BUILD_2019_PATH, BUILD_2022_PATH,
|
|
167
|
-
// CMAKE_2019_PATH, CMAKE_2022_PATH,
|
|
168
|
-
// MSVC_PATH,
|
|
169
|
-
// BUILD_PATH,
|
|
170
|
-
// CMAKE_PATH
|
|
171
|
-
// })
|
|
172
|
-
//
|
|
173
|
-
// return {
|
|
174
|
-
// ROOT_PATH,
|
|
175
|
-
// MSVC_PATH,
|
|
176
|
-
// BUILD_PATH,
|
|
177
|
-
// CMAKE_PATH
|
|
178
|
-
// }
|
|
179
|
-
//
|
|
180
|
-
// }
|
|
181
93
|
async init() {
|
|
182
94
|
if (this.kernel.platform === "win32") {
|
|
183
|
-
let paths = await this.getpaths()
|
|
184
|
-
|
|
185
|
-
const env = {
|
|
186
|
-
PATH: [
|
|
187
|
-
// "C:\\Windows\\System32",
|
|
188
|
-
"C:\\Windows\\System32\\WindowsPowerShell\\v1.0",
|
|
189
|
-
],
|
|
190
|
-
BUILD_PATH: paths.BUILD_PATH
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
if (paths.MSVC_PATH) env.PATH = env.PATH.concat(paths.MSVC_PATH)
|
|
194
|
-
if (paths.BUILD_PATH) env.PATH = env.PATH.concat(paths.BUILD_PATH)
|
|
195
|
-
if (paths.CMAKE_PATH) env.PATH = env.PATH.concat(paths.CMAKE_PATH)
|
|
196
|
-
if (paths.CL_PATH) env.PATH = env.PATH.concat(paths.CL_PATH)
|
|
197
|
-
|
|
198
95
|
/*
|
|
199
96
|
{
|
|
200
97
|
BUILD_PATH: [
|
|
@@ -203,52 +100,19 @@ class VS {
|
|
|
203
100
|
]
|
|
204
101
|
}
|
|
205
102
|
*/
|
|
206
|
-
|
|
207
|
-
if (
|
|
208
|
-
let build_paths = paths.BUILD_PATH
|
|
103
|
+
this._env = await this.getpaths()
|
|
104
|
+
if (this._envs.BUILD_PATH.length > 0) {
|
|
209
105
|
// look for vcvarsall
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
const e2 = await this.kernel.bin.exists(vcvars_path)
|
|
218
|
-
console.log(">1 e2", e2)
|
|
219
|
-
if (e2) {
|
|
220
|
-
env.VCVARSALL_PATH = vcvars_path
|
|
221
|
-
break
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
// only if 2019 doesn't exist try others
|
|
228
|
-
if (!env.VCVARSALL_PATH) {
|
|
229
|
-
for(let p of build_paths) {
|
|
230
|
-
const e = await this.kernel.bin.exists(p)
|
|
231
|
-
console.log(">2 e", { e, p})
|
|
232
|
-
if (e) {
|
|
233
|
-
let vcvars_path = path.resolve(p, "vcvarsall.bat")
|
|
234
|
-
const e2 = await this.kernel.bin.exists(vcvars_path)
|
|
235
|
-
console.log(">2 e2", e2)
|
|
236
|
-
if (e2) {
|
|
237
|
-
env.VCVARSALL_PATH = vcvars_path
|
|
238
|
-
break
|
|
239
|
-
}
|
|
240
|
-
}
|
|
106
|
+
for(let p of this._envs.BUILD_PATH) {
|
|
107
|
+
let vcvars_path = path.resolve(p, "vcvarsall.bat")
|
|
108
|
+
const e = await this.kernel.bin.exists(vcvars_path)
|
|
109
|
+
console.log("> vcvarsall.bat path exists?", { vcvars_path, e })
|
|
110
|
+
if (e) {
|
|
111
|
+
this._env.VCVARSALL_PATH = vcvars_path
|
|
112
|
+
break
|
|
241
113
|
}
|
|
242
114
|
}
|
|
243
|
-
console.log(">>> env", env)
|
|
244
115
|
}
|
|
245
|
-
|
|
246
|
-
// const clpaths = await glob('**/bin/Hostx64/x64/cl.exe', { cwd: paths.MSVC_PATH })
|
|
247
|
-
// if (clpaths && clpaths.length > 0) {
|
|
248
|
-
// let win_cl_path = path.resolve(paths.MSVC_PATH, path.dirname(clpaths[0]))
|
|
249
|
-
// env.PATH.push(win_cl_path)
|
|
250
|
-
// }
|
|
251
|
-
this._env = env
|
|
252
116
|
}
|
|
253
117
|
}
|
|
254
118
|
env () {
|
|
@@ -260,7 +124,7 @@ class VS {
|
|
|
260
124
|
if (this.kernel.platform === "win32") {
|
|
261
125
|
let paths = await this.getpaths()
|
|
262
126
|
console.log("VS INSTALLED CHECK", paths)
|
|
263
|
-
return paths.MSVC_PATH && paths.MSVC_PATH.length > 0 && paths.BUILD_PATH && paths.BUILD_PATH.length > 0 && paths.CMAKE_PATH && paths.CMAKE_PATH.length > 0
|
|
127
|
+
return paths.MSVC_PATH && paths.MSVC_PATH.length > 0 && paths.BUILD_PATH && paths.BUILD_PATH.length > 0 && paths.CMAKE_PATH && paths.CMAKE_PATH.length > 0 && paths.VCVARSALL_PATH && paths.VCVARSALL_PATH.length > 0
|
|
264
128
|
}
|
|
265
129
|
}
|
|
266
130
|
|