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.
Files changed (2) hide show
  1. package/kernel/bin/index.js +72 -45
  2. package/package.json +1 -1
@@ -236,61 +236,88 @@ class Bin {
236
236
  let start
237
237
  let conda_check = {}
238
238
  let conda = new Set()
239
- res = await this.exec({ message: `conda list` }, (stream) => {
240
- // process.stdout.write(stream.raw)
241
- // console.log("conda list check", { stream })
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
- let lines = res.response.split(/[\r\n]+/)
245
- for(let line of lines) {
246
- if (start) {
247
- let chunks = line.split(/\s+/).filter(x => x)
248
- if (chunks.length > 1) {
249
- let name = chunks[0]
250
- let version = chunks[1]
251
- conda.add(name)
252
- if (name === "conda") {
253
- //if (String(version) === "24.11.1") {
254
- if (String(version) === "24.11.3") {
255
- conda_check.conda = true
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
- if (name === "conda-libmamba-solver") {
259
- //if (String(version) === "24.7.0") {
260
- let channel = chunks[3]
261
- let coerced = semver.coerce(version)
262
- let mamba_requirement = ">=24.11.1"
263
- console.log({ name, channel, version })
264
- if (semver.satisfies(coerced, mamba_requirement) && channel === "conda-forge") {
265
- conda_check.mamba = true
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
- // Use sqlite to check if `conda update -y --all` went through successfully
269
- // sometimes it just fails silently so need to check
270
- if (name === "sqlite") {
271
- let coerced = semver.coerce(version)
272
- let sqlite_requirement = ">=3.47.2"
273
- // console.log({ coerced, version, sqlite_requirement })
274
- if (semver.satisfies(coerced, sqlite_requirement)) {
275
- console.log("semver satisfied")
276
- conda_check.sqlite = true
277
- } else {
278
- console.log("semver NOT satisfied")
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
- } else {
283
- if (/.*name.*version.*build.*channel/i.test(line)) {
284
- start = true
309
+ } else {
310
+ if (/.*name.*version.*build.*channel/i.test(line)) {
311
+ start = true
312
+ }
285
313
  }
286
314
  }
287
- }
288
315
 
289
- console.log({ conda_check })
290
- if (conda_check.conda && conda_check.mamba && conda_check.sqlite) {
291
- this.correct_conda = true
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() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "3.2.200",
3
+ "version": "3.2.202",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {