mirror of
https://github.com/koush/scrypted.git
synced 2026-06-20 16:40:30 +01:00
Merge branch 'main' of github.com:koush/scrypted
This commit is contained in:
2
server/bin/packaged-python.d.ts
vendored
2
server/bin/packaged-python.d.ts
vendored
@@ -1,2 +1,2 @@
|
||||
export declare declare const version: string;
|
||||
export declare async function installScryptedServerRequirements(version?: string, dest?: string): Promise<string>;
|
||||
export declare async function installScryptedServerRequirements(version?: string, dest?: string, options?: any): Promise<string>;
|
||||
|
||||
@@ -13,8 +13,8 @@ async function pipInstall(python, pkg) {
|
||||
throw new Error('non-zero exit code: ' + exitCode);
|
||||
}
|
||||
|
||||
module.exports.installScryptedServerRequirements = async function installScryptedServerRequirements(version, dest) {
|
||||
const py = new PortablePython(version || require('./packaged-python').version, dest);
|
||||
module.exports.installScryptedServerRequirements = async function installScryptedServerRequirements(version, dest, options) {
|
||||
const py = new PortablePython(version || require('./packaged-python').version, dest, options);
|
||||
await py.install();
|
||||
let python = py.executablePath;
|
||||
|
||||
|
||||
@@ -116,6 +116,8 @@ export class PythonRuntimeWorker extends ChildProcessWorker {
|
||||
if (process.env.SCRYPTED_PORTABLE_PYTHON && !pluginPythonVersion)
|
||||
pluginPythonVersion = packagedPythonVersion;
|
||||
|
||||
let portablePythonOptions = options.packageJson.scrypted.pythonVersion?.options?.[os.platform()]?.[os.arch()] || options.packageJson.scrypted.pythonVersion?.options?.default || {};
|
||||
|
||||
// if the plugin requests a specific python, then install it via portable python
|
||||
if (!pluginPythonVersion) {
|
||||
setup();
|
||||
@@ -148,7 +150,7 @@ export class PythonRuntimeWorker extends ChildProcessWorker {
|
||||
const pyPath = path.join(getPluginVolume(pluginId), 'py');
|
||||
const portableInstallPath = path.join(pyPath, pyVersion);
|
||||
|
||||
const py = new PortablePython(pluginPythonVersion, portableInstallPath);
|
||||
const py = new PortablePython(pluginPythonVersion, portableInstallPath, portablePythonOptions);
|
||||
if (fs.existsSync(py.executablePath)) {
|
||||
pythonPath = py.executablePath;
|
||||
finishSetup();
|
||||
@@ -158,7 +160,7 @@ export class PythonRuntimeWorker extends ChildProcessWorker {
|
||||
try {
|
||||
this.pythonInstallationComplete = false;
|
||||
await fs.promises.rm(pyPath, { recursive: true, force: true }).catch(() => { });
|
||||
pythonPath = await installScryptedServerRequirements(pluginPythonVersion, portableInstallPath);
|
||||
pythonPath = await installScryptedServerRequirements(pluginPythonVersion, portableInstallPath, portablePythonOptions);
|
||||
finishSetup();
|
||||
}
|
||||
catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user