pinokiod 3.2.152 → 3.2.154
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/conda.js +42 -31
- package/kernel/bin/index.js +71 -25
- package/package.json +1 -1
- package/server/index.js +1 -1
- package/server/views/app.ejs +17 -10
package/kernel/bin/conda.js
CHANGED
|
@@ -99,45 +99,56 @@ create_default_packages:
|
|
|
99
99
|
console.log("CONDA", res.response)
|
|
100
100
|
let lines = res.response.split(/[\r\n]+/)
|
|
101
101
|
let conda_check = {}
|
|
102
|
+
let conda = new Set()
|
|
103
|
+
let start = false
|
|
102
104
|
for(let line of lines) {
|
|
103
|
-
|
|
104
|
-
if (
|
|
105
|
-
let
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
105
|
+
console.log({ line, start })
|
|
106
|
+
if (start) {
|
|
107
|
+
let chunks = line.split(/\s+/).filter(x => x)
|
|
108
|
+
if (chunks.length > 1) {
|
|
109
|
+
let name = chunks[0]
|
|
110
|
+
let version = chunks[1]
|
|
111
|
+
conda.add(name)
|
|
112
|
+
if (name === "conda") {
|
|
113
|
+
if (String(version) === "24.11.1") {
|
|
114
|
+
conda_check.conda = true
|
|
115
|
+
}
|
|
110
116
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
117
|
+
// check conda-libmamba-solver is up to date
|
|
118
|
+
// sometimes it just fails silently so need to check
|
|
119
|
+
if (name === "conda-libmamba-solver") {
|
|
120
|
+
//if (String(version) === "24.7.0") {
|
|
121
|
+
let channel = chunks[3]
|
|
122
|
+
let coerced = semver.coerce(version)
|
|
123
|
+
let mamba_requirement = ">=24.11.1"
|
|
124
|
+
console.log({ name, channel, version })
|
|
125
|
+
if (semver.satisfies(coerced, mamba_requirement) && channel === "conda-forge") {
|
|
126
|
+
conda_check.mamba = true
|
|
127
|
+
}
|
|
122
128
|
}
|
|
123
|
-
}
|
|
124
129
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
130
|
+
// Use sqlite to check if `conda update -y --all` went through successfully
|
|
131
|
+
// sometimes it just fails silently so need to check
|
|
132
|
+
if (name === "sqlite") {
|
|
133
|
+
let coerced = semver.coerce(version)
|
|
134
|
+
let sqlite_requirement = ">=3.47.2"
|
|
135
|
+
console.log({ coerced, version, sqlite_requirement })
|
|
136
|
+
if (semver.satisfies(coerced, sqlite_requirement)) {
|
|
137
|
+
console.log("semver satisfied")
|
|
138
|
+
conda_check.sqlite = true
|
|
139
|
+
} else {
|
|
140
|
+
console.log("semver NOT satisfied")
|
|
141
|
+
}
|
|
136
142
|
}
|
|
137
143
|
}
|
|
144
|
+
} else {
|
|
145
|
+
if (/.*name.*version.*build.*channel/i.test(line)) {
|
|
146
|
+
start = true
|
|
147
|
+
}
|
|
138
148
|
}
|
|
139
149
|
}
|
|
140
|
-
console.log("> Check", { conda_check })
|
|
150
|
+
console.log("> Check", { conda_check, conda })
|
|
151
|
+
this.kernel.bin.installed.conda = conda
|
|
141
152
|
return conda_check.conda && conda_check.mamba && conda_check.sqlite
|
|
142
153
|
}
|
|
143
154
|
async install(req, ondata) {
|
package/kernel/bin/index.js
CHANGED
|
@@ -244,6 +244,7 @@ class Bin {
|
|
|
244
244
|
console.log("CONDA", res.response)
|
|
245
245
|
let lines = res.response.split(/[\r\n]+/)
|
|
246
246
|
for(let line of lines) {
|
|
247
|
+
console.log({ line, start })
|
|
247
248
|
if (start) {
|
|
248
249
|
let chunks = line.split(/\s+/).filter(x => x)
|
|
249
250
|
if (chunks.length > 1) {
|
|
@@ -280,7 +281,7 @@ class Bin {
|
|
|
280
281
|
}
|
|
281
282
|
}
|
|
282
283
|
} else {
|
|
283
|
-
if (
|
|
284
|
+
if (/.*name.*version.*build.*channel/i.test(line)) {
|
|
284
285
|
start = true
|
|
285
286
|
}
|
|
286
287
|
}
|
|
@@ -486,10 +487,10 @@ class Bin {
|
|
|
486
487
|
|
|
487
488
|
let install = requirement.install // custom install command
|
|
488
489
|
let args = requirement.args || ""
|
|
489
|
-
if (requirement.installed) {
|
|
490
|
-
console.log("Already installed", requirement)
|
|
491
|
-
} else {
|
|
492
|
-
console.log("Not yet installed", requirement)
|
|
490
|
+
// if (requirement.installed) {
|
|
491
|
+
// console.log("Already installed", requirement)
|
|
492
|
+
// } else {
|
|
493
|
+
// console.log("Not yet installed", requirement)
|
|
493
494
|
/*
|
|
494
495
|
{
|
|
495
496
|
platform: win32|darwin|linux|<none>,
|
|
@@ -542,7 +543,7 @@ class Bin {
|
|
|
542
543
|
}
|
|
543
544
|
|
|
544
545
|
}
|
|
545
|
-
}
|
|
546
|
+
// }
|
|
546
547
|
}
|
|
547
548
|
async install(req, ondata) {
|
|
548
549
|
/*
|
|
@@ -564,31 +565,76 @@ class Bin {
|
|
|
564
565
|
}
|
|
565
566
|
|
|
566
567
|
let requirements = JSON.parse(req.params)
|
|
567
|
-
|
|
568
|
-
for(let
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
for(let
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
await this.
|
|
575
|
-
console.log(`## [${x}] Install Step
|
|
576
|
-
|
|
577
|
-
|
|
568
|
+
|
|
569
|
+
for(let x=0; x<10; x++) {
|
|
570
|
+
console.log(`## Install Attempt ${x}`)
|
|
571
|
+
let i = 0;
|
|
572
|
+
for(let requirement of requirements) {
|
|
573
|
+
i++;
|
|
574
|
+
// Retry at least 5 times until it succeeds
|
|
575
|
+
let installed = await this._installed(requirement.name, requirement.type)
|
|
576
|
+
console.log(`## [${x}] Install Step 1: Check installed before installing`, requirement.name, installed)
|
|
577
|
+
if (installed) {
|
|
578
|
+
// skip
|
|
579
|
+
console.log("already installed. skip.")
|
|
580
|
+
} else {
|
|
581
|
+
console.log("not installed. install.")
|
|
582
|
+
await this.tryInstall(requirement, i, requirements.length, ondata)
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
// refresh installed
|
|
587
|
+
await this.refreshInstalled()
|
|
588
|
+
|
|
589
|
+
// check all requirements if they're installed
|
|
590
|
+
|
|
591
|
+
let install_success = true
|
|
592
|
+
for(let requirement of requirements) {
|
|
578
593
|
let installed = await this._installed(requirement.name, requirement.type)
|
|
594
|
+
console.log(`## [${x}] Install Step 2: Check installed after installing`, requirement.name, installed)
|
|
579
595
|
if (installed) {
|
|
580
|
-
console.log(
|
|
581
|
-
break;
|
|
596
|
+
console.log("already installed.")
|
|
582
597
|
} else {
|
|
583
|
-
console.log(
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
resolve()
|
|
587
|
-
}, 2000)
|
|
588
|
-
})
|
|
598
|
+
console.log("not installed.")
|
|
599
|
+
install_success = false
|
|
600
|
+
break
|
|
589
601
|
}
|
|
590
602
|
}
|
|
603
|
+
|
|
604
|
+
// if install successful, break.
|
|
605
|
+
// otherwise repeat
|
|
606
|
+
console.log(`## [${x}] Install Step 3: All Installed? ${install_success}`)
|
|
607
|
+
if (install_success) {
|
|
608
|
+
console.log("Successful. Break")
|
|
609
|
+
break
|
|
610
|
+
} else {
|
|
611
|
+
console.log("Not Successful. Retry.")
|
|
612
|
+
}
|
|
591
613
|
}
|
|
614
|
+
//for(let requirement of requirements) {
|
|
615
|
+
// i++;
|
|
616
|
+
// // Retry at least 5 times until it succeeds
|
|
617
|
+
// for(let x=0; x<10; x++) {
|
|
618
|
+
// console.log(`## Install Interation: ${x}`)
|
|
619
|
+
// console.log(`## [${x}] Install Step 1: Try Install`, requirement)
|
|
620
|
+
// await this.tryInstall(requirement, i, requirements.length, ondata)
|
|
621
|
+
// console.log(`## [${x}] Install Step 2: Refresh Installed`)
|
|
622
|
+
// await this.refreshInstalled()
|
|
623
|
+
// console.log(`## [${x}] Install Step 3: Check Installed`, requirement)
|
|
624
|
+
// let installed = await this._installed(requirement.name, requirement.type)
|
|
625
|
+
// if (installed) {
|
|
626
|
+
// console.log(`## [${x}] Install Step 4: Installed Successful. Break`, requirement)
|
|
627
|
+
// break;
|
|
628
|
+
// } else {
|
|
629
|
+
// console.log(`## [${x}] Install Step 4: Install Unsuccessful. Retrying in 2 seconds`, requirement)
|
|
630
|
+
// await new Promise((resolve, reject) => {
|
|
631
|
+
// setTimeout(()=> {
|
|
632
|
+
// resolve()
|
|
633
|
+
// }, 2000)
|
|
634
|
+
// })
|
|
635
|
+
// }
|
|
636
|
+
// }
|
|
637
|
+
//}
|
|
592
638
|
await this.init()
|
|
593
639
|
}
|
|
594
640
|
async _installed(name, type) {
|
package/package.json
CHANGED
package/server/index.js
CHANGED
|
@@ -234,7 +234,7 @@ class Server {
|
|
|
234
234
|
console.log("semver satisfied", config.version, this.kernel.schema)
|
|
235
235
|
} else {
|
|
236
236
|
console.log("semver NOT satisfied", config.version, this.kernel.schema)
|
|
237
|
-
error = `Please update
|
|
237
|
+
error = `Please update to the latest Pinokio (current script version: ${config.version}, supported: ${this.kernel.schema})`
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
240
|
|
package/server/views/app.ejs
CHANGED
|
@@ -399,23 +399,30 @@ nav .logo {
|
|
|
399
399
|
font-size: 14px;
|
|
400
400
|
padding: 10px;
|
|
401
401
|
}
|
|
402
|
-
|
|
403
|
-
margin-right:
|
|
402
|
+
.error-message .btn i {
|
|
403
|
+
margin-right: 10px;
|
|
404
404
|
}
|
|
405
|
-
|
|
405
|
+
.error-message .btn {
|
|
406
|
+
margin-top: 20px;
|
|
406
407
|
align-items: center;
|
|
407
408
|
display: flex;
|
|
408
409
|
letter-spacing: 0px;
|
|
409
410
|
background: black;
|
|
410
411
|
color: yellow;
|
|
411
412
|
font-size: 20px;
|
|
412
|
-
padding: 10px
|
|
413
|
+
padding: 10px 30px;
|
|
413
414
|
}
|
|
414
|
-
|
|
415
|
+
.error-message {
|
|
416
|
+
display: flex;
|
|
417
|
+
flex-direction: column;
|
|
418
|
+
justify-content: center;
|
|
419
|
+
align-items: center;
|
|
420
|
+
font-weight: bold;
|
|
415
421
|
background: yellow !important;
|
|
416
422
|
flex-grow: 1;
|
|
417
|
-
padding: 50px;
|
|
423
|
+
padding: 0 50px;
|
|
418
424
|
font-size: 40px;
|
|
425
|
+
line-height: 40px;
|
|
419
426
|
color: black;
|
|
420
427
|
letter-spacing: -2px;
|
|
421
428
|
}
|
|
@@ -635,11 +642,11 @@ body.dark .loader-container {
|
|
|
635
642
|
-->
|
|
636
643
|
</aside>
|
|
637
644
|
<% if (error) { %>
|
|
638
|
-
<
|
|
639
|
-
<
|
|
640
|
-
<div
|
|
645
|
+
<div class='error-message'>
|
|
646
|
+
<h1><i class="fa-solid fa-rotate"></i></h1>
|
|
647
|
+
<div><%=error%></div>
|
|
641
648
|
<a class='btn' target="_blank" href="https://program.pinokio.computer/#/?id=install"><i class="fa-solid fa-square-arrow-up-right"></i> Download</a>
|
|
642
|
-
</
|
|
649
|
+
</div>
|
|
643
650
|
<% } else { %>
|
|
644
651
|
<div class='container'>
|
|
645
652
|
<nav>
|