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 +20 -7
- package/package.json +1 -1
- package/server/index.js +1 -1
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
package/server/index.js
CHANGED