This commit is contained in:
Koushik Dutta
2024-03-09 00:51:14 -08:00
parent 1cb9985cf8
commit f8669ea693
4 changed files with 19 additions and 19 deletions

View File

@@ -1,8 +1,7 @@
#!/usr/bin/env node
const path = require('path');
const child_process = require('child_process');
const { PortablePython } = require('@bjia56/portable-python')
const { PortablePython } = require('py')
const { once } = require('events');
let python;
@@ -14,7 +13,7 @@ async function pipInstall(pkg) {
}
async function installScryptedServerRequirements() {
const py = new PortablePython("3.9", path.join(path.dirname(__dirname), 'py'));
const py = new PortablePython("3.9");
await py.install();
python = py.executablePath;

View File

@@ -1,16 +1,15 @@
{
"name": "@scrypted/server",
"version": "0.94.20",
"version": "0.94.21",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@scrypted/server",
"version": "0.94.20",
"version": "0.94.21",
"hasInstallScript": true,
"license": "ISC",
"dependencies": {
"@bjia56/portable-python": "^0.1.3",
"@mapbox/node-pre-gyp": "^1.0.11",
"@scrypted/types": "^0.3.13",
"adm-zip": "^0.5.10",
@@ -28,6 +27,7 @@
"node-dijkstra": "^2.5.0",
"node-forge": "^1.3.1",
"node-gyp": "^10.0.1",
"py": "npm:@bjia56/portable-python@^0.1.6",
"router": "^1.3.8",
"semver": "^7.6.0",
"sharp": "^0.33.2",
@@ -61,14 +61,6 @@
"@homebridge/node-pty-prebuilt-multiarch": "^0.11.12"
}
},
"node_modules/@bjia56/portable-python": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/@bjia56/portable-python/-/portable-python-0.1.3.tgz",
"integrity": "sha512-LCevOAfR3EcpHxhn2HmJPYMKwlx6gFak1L5yT+HDZTpCZCJso5Fs55z04dZ3XHJGOP/nYSwcpVmcdPArJzfeFQ==",
"dependencies": {
"adm-zip": "^0.5.10"
}
},
"node_modules/@derhuerst/http-basic": {
"version": "8.2.4",
"resolved": "https://registry.npmjs.org/@derhuerst/http-basic/-/http-basic-8.2.4.tgz",
@@ -2973,6 +2965,15 @@
"once": "^1.3.1"
}
},
"node_modules/py": {
"name": "@bjia56/portable-python",
"version": "0.1.6",
"resolved": "https://registry.npmjs.org/@bjia56/portable-python/-/portable-python-0.1.6.tgz",
"integrity": "sha512-4nisy20S/RAmg7E1lBFJHJx0YNaRdIL9XKrlSPUNTRj0xdwXlW+WduSa/27HnhpiKmeU7moD2aaRJHO7h7oLFA==",
"dependencies": {
"adm-zip": "^0.5.10"
}
},
"node_modules/qs": {
"version": "6.11.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",

View File

@@ -1,9 +1,8 @@
{
"name": "@scrypted/server",
"version": "0.94.21",
"version": "0.94.22",
"description": "",
"dependencies": {
"@bjia56/portable-python": "^0.1.3",
"@mapbox/node-pre-gyp": "^1.0.11",
"@scrypted/types": "^0.3.13",
"adm-zip": "^0.5.10",
@@ -21,6 +20,7 @@
"node-dijkstra": "^2.5.0",
"node-forge": "^1.3.1",
"node-gyp": "^10.0.1",
"py": "npm:@bjia56/portable-python@^0.1.6",
"router": "^1.3.8",
"semver": "^7.6.0",
"sharp": "^0.33.2",

View File

@@ -7,13 +7,13 @@ import { RpcMessage, RpcPeer } from "../../rpc";
import { createRpcDuplexSerializer } from '../../rpc-serializer';
import { ChildProcessWorker } from "./child-process-worker";
import { RuntimeWorkerOptions } from "./runtime-worker";
import type {PortablePython as PortablePythonType} from '@bjia56/portable-python'
import type {PortablePython as PortablePythonType} from 'py'
export class PythonRuntimeWorker extends ChildProcessWorker {
static {
try {
const PortablePython = require('@bjia56/portable-python').PortablePython as typeof PortablePythonType;
const py = new PortablePython("3.9", path.join(path.dirname(__dirname), '..', '..', 'py'));
const PortablePython = require('py').PortablePython as typeof PortablePythonType;
const py = new PortablePython("3.9");
const portablePython = py.executablePath;
if (fs.existsSync(portablePython))
process.env.SCRYPTED_PYTHON_PATH = portablePython;