pinokiod 3.5.19 → 3.5.20

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.
@@ -55,9 +55,9 @@ class Cuda {
55
55
  }
56
56
  }
57
57
  env() {
58
- // return {
59
- // CUDA_HOME: "$CONDA_PREFIX"
60
- // }
58
+ return {
59
+ CUDA_HOME: this.kernel.bin.path("miniconda")
60
+ }
61
61
  }
62
62
  // env() {
63
63
  // return {
package/kernel/bin/py.js CHANGED
@@ -2,6 +2,7 @@ const fse = require('fs-extra')
2
2
  const path = require('path')
3
3
  class Py {
4
4
  async install(req, ondata) {
5
+ // set the permission
5
6
  await fse.remove(this.kernel.path('bin/py'))
6
7
  await this.kernel.exec({
7
8
  message: "git clone https://github.com/pinokiocomputer/python py",
package/kernel/index.js CHANGED
@@ -372,28 +372,16 @@ class Kernel {
372
372
  }
373
373
  async initHome() {
374
374
  if (this.homedir) {
375
- let home_exists = await this.exists(this.homedir)
376
- if (!home_exists) {
377
- // first make dir
378
- await fs.promises.mkdir(this.homedir, { recursive: true }).catch((e) => {})
379
- // then wait until the app launches, and when it launches, grant access
380
- if (this.platform === "win32") {
381
- console.log("[initHome] Wait until the app launches")
382
- let interval = setInterval(async () => {
383
- console.log("[initHome] Has the app launched?", this.launch_complete)
384
- if (this.launch_complete) {
385
- console.log("[initHome] 1 Give full permission")
386
- clearInterval(interval)
387
- await this.bin.exec({
388
- sudo: true,
389
- message: `icacls ${this.homedir} /grant *S-1-1-0:(OI)(CI)F /T`
390
- }, (stream) => {
391
- process.stdout.write(stream.raw)
392
- })
393
- console.log("[initHome] 2 Give full permission done")
394
- }
395
- }, 1000)
396
- }
375
+ await fs.promises.mkdir(this.homedir, { recursive: true }).catch((e) => {})
376
+ if (this.platform === "win32") {
377
+ console.log("[initHome] 1 Give full permission")
378
+ await this.bin.exec({
379
+ sudo: true,
380
+ message: `icacls ${this.homedir} /grant *S-1-1-0:(OI)(CI)F /T`
381
+ }, (stream) => {
382
+ process.stdout.write(stream.raw)
383
+ })
384
+ console.log("[initHome] 2 Give full permission done")
397
385
  }
398
386
  }
399
387
  }
@@ -471,6 +459,10 @@ class Kernel {
471
459
  let home_exists = await this.exists(this.homedir)
472
460
  console.log({ home_exists, homedir: this.homedir })
473
461
  if (!home_exists) {
462
+ // home didn't exist.
463
+ // 1. mkdir
464
+ await fs.promises.mkdir(this.homedir, { recursive: true }).catch((e) => {})
465
+ // 2. and then add permission
474
466
  await this.initHome()
475
467
  }
476
468
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "3.5.19",
3
+ "version": "3.5.20",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/server/index.js CHANGED
@@ -2025,7 +2025,6 @@ class Server {
2025
2025
  console.log({ homedir })
2026
2026
  let logsdir = path.resolve(homedir, "logs")
2027
2027
  console.log({ logsdir })
2028
- await this.kernel.initHome()
2029
2028
  await fs.promises.mkdir(logsdir, { recursive: true }).catch((e) => { console.log(e) })
2030
2029
  console.log("this.log", this.log)
2031
2030
  if (!this.log) {
@@ -2131,10 +2130,16 @@ class Server {
2131
2130
  let version = this.kernel.store.get("version")
2132
2131
  let home = this.kernel.store.get("home")
2133
2132
  console.log({ home, version })
2133
+
2134
+ let needInitHome = false
2134
2135
  if (home) {
2135
2136
  if (version === this.version.pinokiod) {
2136
2137
  console.log("version up to date")
2137
2138
  } else {
2139
+ // For every update, this gets triggered exactly once.
2140
+ // 1. first mkdir if it doesn't exist (this step is irrelevant since at this point the home dir will exist)
2141
+
2142
+ needInitHome = true
2138
2143
  console.log("not up to date. update py.")
2139
2144
  // remove ~/bin/miniconda/py
2140
2145
  let p = path.resolve(home, "bin/py")
@@ -2150,6 +2155,10 @@ class Server {
2150
2155
  // initialize kernel
2151
2156
  await this.kernel.init({ port: this.port})
2152
2157
 
2158
+ console.log({ needInitHome })
2159
+ if (needInitHome) {
2160
+ await this.kernel.initHome()
2161
+ }
2153
2162
 
2154
2163
  if (this.kernel.homedir) {
2155
2164
  let ex = await this.kernel.exists(this.kernel.homedir, "ENVIRONMENT")