pinokiod 3.2.129 → 3.2.130

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 +67 -73
  2. package/package.json +1 -1
@@ -229,6 +229,66 @@ class Bin {
229
229
  this.installed.brew = Set()
230
230
  */
231
231
  }
232
+ async tryList() {
233
+ let res
234
+ let conda_check
235
+ let conda = new Set()
236
+ res = await this.exec({ message: `conda list` }, (stream) => {
237
+ // console.log("conda list check", { stream })
238
+ })
239
+
240
+ console.log("CONDA", res.response)
241
+ lines = res.response.split(/[\r\n]+/)
242
+ for(let line of lines) {
243
+ if (start) {
244
+ let chunks = line.split(/\s+/).filter(x => x)
245
+ if (chunks.length > 1) {
246
+ let name = chunks[0]
247
+ let version = chunks[1]
248
+ conda.add(name)
249
+ if (name === "conda") {
250
+ if (String(version) === "24.11.1") {
251
+ conda_check.conda = true
252
+ }
253
+ }
254
+ if (name === "conda-libmamba-solver") {
255
+ //if (String(version) === "24.7.0") {
256
+ let channel = chunks[3]
257
+ let coerced = semver.coerce(version)
258
+ let mamba_requirement = ">=24.11.1"
259
+ console.log({ name, channel, version })
260
+ if (semver.satisfies(coerced, mamba_requirement) && channel === "conda-forge") {
261
+ conda_check.mamba = true
262
+ }
263
+ }
264
+ // Use sqlite to check if `conda update -y --all` went through successfully
265
+ // sometimes it just fails silently so need to check
266
+ if (name === "sqlite") {
267
+ let coerced = semver.coerce(version)
268
+ let sqlite_requirement = ">=3.47.2"
269
+ console.log({ coerced, version, sqlite_requirement })
270
+ if (semver.satisfies(coerced, sqlite_requirement)) {
271
+ console.log("semver satisfied")
272
+ conda_check.sqlite = true
273
+ } else {
274
+ console.log("semver NOT satisfied")
275
+ }
276
+ }
277
+ }
278
+ } else {
279
+ if (/name.*version.*build.*channel/i.test(line)) {
280
+ start = true
281
+ }
282
+ }
283
+ }
284
+
285
+ console.log({ conda_check })
286
+ if (conda_check.conda && conda_check.mamba && conda_check.sqlite) {
287
+ this.correct_conda = true
288
+ }
289
+
290
+ this.installed.conda = conda
291
+ }
232
292
  async refreshInstalled() {
233
293
 
234
294
  console.log("refreshInstalled start")
@@ -249,88 +309,22 @@ class Bin {
249
309
  let conda_exists = await this.exists(conda_path)
250
310
  console.log({ conda_path, conda_exists })
251
311
 
252
- let conda = new Set()
253
312
  let start
254
313
  let res
255
314
  let lines
256
315
  let conda_check = {}
257
316
  if (conda_exists) {
258
- res = await this.exec({ message: `conda list` }, (stream) => {
259
- // console.log("conda list check", { stream })
260
- })
261
-
262
- console.log("CONDA", res.response)
263
- lines = res.response.split(/[\r\n]+/)
264
- for(let line of lines) {
265
- if (start) {
266
- let chunks = line.split(/\s+/).filter(x => x)
267
- if (chunks.length > 1) {
268
- let name = chunks[0]
269
- let version = chunks[1]
270
- conda.add(name)
271
- if (name === "conda") {
272
- if (String(version) === "24.11.1") {
273
- //if (String(version) === "24.11.3") {
274
- //if (String(version) === "24.9.0") {
275
- //if (String(version) === "24.7.1") {
276
- //if (String(version) === "24.11.2") {
277
- conda_check.conda = true
278
- }
279
- }
280
-
281
- // // check conda-libmamba-solver is up to date
282
- // // sometimes it just fails silently so need to check
283
- // if (name === "conda-libmamba-solver") {
284
- // //if (String(version) === "24.7.0") {
285
- // let channel = chunks[3]
286
- // console.log({ name, channel, version })
287
- // if (String(version) === "24.11.1" && channel === "conda-forge") {
288
- // conda_check.mamba = true
289
- // }
290
- // }
291
- if (name === "conda-libmamba-solver") {
292
- //if (String(version) === "24.7.0") {
293
- let channel = chunks[3]
294
- let coerced = semver.coerce(version)
295
- let mamba_requirement = ">=24.11.1"
296
- console.log({ name, channel, version })
297
- if (semver.satisfies(coerced, mamba_requirement) && channel === "conda-forge") {
298
- conda_check.mamba = true
299
- }
300
- }
301
-
302
-
303
- // Use sqlite to check if `conda update -y --all` went through successfully
304
- // sometimes it just fails silently so need to check
305
- if (name === "sqlite") {
306
- let coerced = semver.coerce(version)
307
- let sqlite_requirement = ">=3.47.2"
308
- console.log({ coerced, version, sqlite_requirement })
309
- if (semver.satisfies(coerced, sqlite_requirement)) {
310
- console.log("semver satisfied")
311
- conda_check.sqlite = true
312
- } else {
313
- console.log("semver NOT satisfied")
314
- }
315
- }
316
- }
317
- } else {
318
- if (/name.*version.*build.*channel/i.test(line)) {
319
- start = true
320
- }
317
+ // Try 3 times, because sometimes conda just silently quits with no error message
318
+ for(let i=0; i<3; i++) {
319
+ console.log("tryList", i)
320
+ await this.tryList()
321
+ console.log("> conda list", this.installed.conda)
322
+ if (this.installed.conda.size > 0) {
323
+ break
321
324
  }
322
325
  }
323
326
  }
324
327
 
325
- console.log({ conda_check })
326
- if (conda_check.conda && conda_check.mamba && conda_check.sqlite) {
327
- //if (conda_check.conda && conda_check.sqlite) {
328
- //if (conda_check.conda) {
329
- this.correct_conda = true
330
- }
331
-
332
- this.installed.conda = conda
333
-
334
328
  // 2. pip
335
329
  let pip = new Set()
336
330
  if (conda_exists) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "3.2.129",
3
+ "version": "3.2.130",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {