pinokiod 3.2.192 → 3.2.194

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/py.js CHANGED
@@ -1,4 +1,5 @@
1
1
  const fse = require('fs-extra')
2
+ const path = require('path')
2
3
  class Py {
3
4
  async install(req, ondata) {
4
5
  await fse.remove(this.kernel.path('bin/py'))
@@ -14,15 +15,27 @@ class Py {
14
15
  }
15
16
  async installed() {
16
17
  let exists = await this.kernel.exists(this.kernel.bin.path("py"))
17
- try {
18
- if (exists) {
19
- return this.kernel.bin.installed.pip.has("fastapi") && this.kernel.bin.installed.pip.has("uvicorn") && this.kernel.bin.installed.pip.has("importlib_metadata")
20
- } else {
21
- return false
18
+ let exists2 = await this.kernel.exists(this.kernel.bin.path("py/env"))
19
+ let site_packages_root
20
+ if (this.kernel.platform === "win32") {
21
+ site_packages_root = this.kernel.bin.path("py/env/Lib/site-packages")
22
+ } else {
23
+ site_packages_root = this.kernel.bin.path("py/env/lib/python3.10/site-packages")
24
+ }
25
+ let module_paths = ["fastapi", "uvicorn", "importlib_metadata"].map((name) => {
26
+ return path.resolve(site_packages_root, name)
27
+ })
28
+ let exists3 = await this.kernel.exists(site_packages_root)
29
+ let exists4 = true
30
+ for(let module_path of module_paths) {
31
+ let exists = await this.kernel.exists(module_path)
32
+ if (!exists) {
33
+ exists4 = false
34
+ break;
22
35
  }
23
- } catch (e) {
24
- return false
25
36
  }
37
+ console.log({ exists, exists2, exists3, exists4 })
38
+ return exists && exists2 && exists3 && exists4
26
39
  }
27
40
  async uninstall(req, ondata) {
28
41
  await this.kernel.bin.rm(this.kernel.bin.path("py"), ondata)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "3.2.192",
3
+ "version": "3.2.194",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/server/index.js CHANGED
@@ -2149,7 +2149,7 @@ class Server {
2149
2149
  sudo: true,
2150
2150
  message: `icacls ${this.kernel.homedir} /grant Users:(OI)(CI)F /T`
2151
2151
  }, (stream) => {
2152
- ondata(stream)
2152
+ console.log({ stream })
2153
2153
  })
2154
2154
  console.log("1 Give full permission done")
2155
2155
  }