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.
Files changed (2) hide show
  1. package/kernel/bin/index.js +71 -45
  2. package/package.json +1 -1
@@ -236,61 +236,87 @@ 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
+ 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
- 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
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
- 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
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
- // 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")
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
- } else {
283
- if (/.*name.*version.*build.*channel/i.test(line)) {
284
- start = true
308
+ } else {
309
+ if (/.*name.*version.*build.*channel/i.test(line)) {
310
+ start = true
311
+ }
285
312
  }
286
313
  }
287
- }
288
314
 
289
- console.log({ conda_check })
290
- if (conda_check.conda && conda_check.mamba && conda_check.sqlite) {
291
- this.correct_conda = true
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() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "3.2.200",
3
+ "version": "3.2.201",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {