pinokiod 1.0.48 → 1.0.50
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/api/fs/index.js +6 -5
- package/kernel/python/index.js +4 -2
- package/package.json +1 -1
package/kernel/api/fs/index.js
CHANGED
|
@@ -101,7 +101,7 @@ class FS {
|
|
|
101
101
|
// {
|
|
102
102
|
// “method”: “fs.share”,
|
|
103
103
|
// “params”: {
|
|
104
|
-
// "
|
|
104
|
+
// "venv": "app/env"
|
|
105
105
|
// }
|
|
106
106
|
// }
|
|
107
107
|
//
|
|
@@ -109,20 +109,21 @@ class FS {
|
|
|
109
109
|
|
|
110
110
|
ondata({ raw: "\r\ncreating a shared drive:\r\n" + JSON.stringify(req.params, null, 2).replace(/\n/g, "\r\n") })
|
|
111
111
|
|
|
112
|
-
if (req.params.
|
|
112
|
+
if (req.params.venv) {
|
|
113
113
|
// pip sharing
|
|
114
114
|
// 1. get all pip items
|
|
115
115
|
let p
|
|
116
116
|
if (kernel.platform === "win32") {
|
|
117
|
-
p = path.resolve(req.cwd, req.params.
|
|
117
|
+
p = path.resolve(req.cwd, req.params.venv, "Lib", "site-packages")
|
|
118
118
|
} else {
|
|
119
|
-
p = path.resolve(req.cwd, req.params.
|
|
119
|
+
p = path.resolve(req.cwd, req.params.venv, "lib", "python3.10", "site-packages")
|
|
120
120
|
}
|
|
121
121
|
const res = await kernel.python.call(
|
|
122
122
|
"pip",
|
|
123
123
|
path.resolve(__dirname, "../../python/pip.py"),
|
|
124
124
|
"list",
|
|
125
|
-
[p]
|
|
125
|
+
[p],
|
|
126
|
+
ondata
|
|
126
127
|
)
|
|
127
128
|
const d = {}
|
|
128
129
|
// symlink:
|
package/kernel/python/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
const path = require('path')
|
|
2
|
-
const nodecallspython = require("node-calls-python");
|
|
3
2
|
class Python {
|
|
4
3
|
constructor(kernel) {
|
|
5
4
|
this.kernel = kernel
|
|
6
5
|
}
|
|
7
|
-
async call(modname, modpath, method, args) {
|
|
6
|
+
async call(modname, modpath, method, args, ondata) {
|
|
7
|
+
console.log("CALL", { modname, modpath, method, args })
|
|
8
8
|
// if this.proc doesn't exist, create
|
|
9
9
|
if (!this.proc) {
|
|
10
10
|
await this.kernel.exec({
|
|
@@ -14,6 +14,7 @@ class Python {
|
|
|
14
14
|
],
|
|
15
15
|
conda: "base"
|
|
16
16
|
}, (s) => {
|
|
17
|
+
ondata(s)
|
|
17
18
|
})
|
|
18
19
|
await new Promise((resolve, reject) => {
|
|
19
20
|
this.kernel.exec({
|
|
@@ -22,6 +23,7 @@ class Python {
|
|
|
22
23
|
conda: "base"
|
|
23
24
|
}, (s) => {
|
|
24
25
|
// process.stdout.write(s)
|
|
26
|
+
ondata(s)
|
|
25
27
|
if (/Uvicorn running on/i.test(s.cleaned)) {
|
|
26
28
|
resolve()
|
|
27
29
|
}
|