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