pinokiod 3.2.200 → 3.2.202
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/index.js +72 -45
- package/package.json +1 -1
package/kernel/bin/index.js
CHANGED
|
@@ -236,61 +236,88 @@ class Bin {
|
|
|
236
236
|
let start
|
|
237
237
|
let conda_check = {}
|
|
238
238
|
let conda = new Set()
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
//
|
|
239
|
+
|
|
240
|
+
//////////////////////////////////////////////////////////////////
|
|
241
|
+
// exception handling
|
|
242
|
+
// if importlib_metadata || uvicorn || fastapi exist in the base environment, this.correct_conda = false
|
|
243
|
+
let site_packages_path
|
|
244
|
+
if (this.platform === "win32") {
|
|
245
|
+
site_packages_path = path.resolve(this.kernel.homedir, "bin/miniconda/Lib/site-packages")
|
|
246
|
+
} else {
|
|
247
|
+
site_packages_path = path.resolve(this.kernel.homedir, "bin/miniconda/lib/python3.10/site-packages")
|
|
248
|
+
}
|
|
249
|
+
// check if any of 'uvicorn', 'importlib_metadata', 'fastapi' exists
|
|
250
|
+
let module_paths = ["fastapi", "uvicorn", "importlib_metadata"].map((name) => {
|
|
251
|
+
return path.resolve(site_packages_path, name)
|
|
242
252
|
})
|
|
253
|
+
let to_reset_exists = false
|
|
254
|
+
for(let module_path of module_paths) {
|
|
255
|
+
let e = await this.kernel.exists(module_path)
|
|
256
|
+
console.log({ e, module_path })
|
|
257
|
+
if (e) {
|
|
258
|
+
to_reset_exists = true
|
|
259
|
+
break;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
console.log({ to_reset_exists })
|
|
263
|
+
if (to_reset_exists) {
|
|
264
|
+
this.correct_conda = false
|
|
265
|
+
} else {
|
|
266
|
+
res = await this.exec({ message: `conda list` }, (stream) => {
|
|
267
|
+
// process.stdout.write(stream.raw)
|
|
268
|
+
// console.log("conda list check", { stream })
|
|
269
|
+
})
|
|
243
270
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
271
|
+
let lines = res.response.split(/[\r\n]+/)
|
|
272
|
+
for(let line of lines) {
|
|
273
|
+
if (start) {
|
|
274
|
+
let chunks = line.split(/\s+/).filter(x => x)
|
|
275
|
+
if (chunks.length > 1) {
|
|
276
|
+
let name = chunks[0]
|
|
277
|
+
let version = chunks[1]
|
|
278
|
+
conda.add(name)
|
|
279
|
+
if (name === "conda") {
|
|
280
|
+
//if (String(version) === "24.11.1") {
|
|
281
|
+
if (String(version) === "24.11.3") {
|
|
282
|
+
conda_check.conda = true
|
|
283
|
+
}
|
|
256
284
|
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
285
|
+
if (name === "conda-libmamba-solver") {
|
|
286
|
+
//if (String(version) === "24.7.0") {
|
|
287
|
+
let channel = chunks[3]
|
|
288
|
+
let coerced = semver.coerce(version)
|
|
289
|
+
let mamba_requirement = ">=24.11.1"
|
|
290
|
+
console.log({ name, channel, version })
|
|
291
|
+
if (semver.satisfies(coerced, mamba_requirement) && channel === "conda-forge") {
|
|
292
|
+
conda_check.mamba = true
|
|
293
|
+
}
|
|
266
294
|
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
295
|
+
// Use sqlite to check if `conda update -y --all` went through successfully
|
|
296
|
+
// sometimes it just fails silently so need to check
|
|
297
|
+
if (name === "sqlite") {
|
|
298
|
+
let coerced = semver.coerce(version)
|
|
299
|
+
let sqlite_requirement = ">=3.47.2"
|
|
300
|
+
// console.log({ coerced, version, sqlite_requirement })
|
|
301
|
+
if (semver.satisfies(coerced, sqlite_requirement)) {
|
|
302
|
+
console.log("semver satisfied")
|
|
303
|
+
conda_check.sqlite = true
|
|
304
|
+
} else {
|
|
305
|
+
console.log("semver NOT satisfied")
|
|
306
|
+
}
|
|
279
307
|
}
|
|
280
308
|
}
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
309
|
+
} else {
|
|
310
|
+
if (/.*name.*version.*build.*channel/i.test(line)) {
|
|
311
|
+
start = true
|
|
312
|
+
}
|
|
285
313
|
}
|
|
286
314
|
}
|
|
287
|
-
}
|
|
288
315
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
316
|
+
console.log({ conda_check })
|
|
317
|
+
if (conda_check.conda && conda_check.mamba && conda_check.sqlite) {
|
|
318
|
+
this.correct_conda = true
|
|
319
|
+
}
|
|
292
320
|
}
|
|
293
|
-
|
|
294
321
|
this.installed.conda = conda
|
|
295
322
|
}
|
|
296
323
|
async refreshInstalled() {
|