mirror of
https://github.com/koush/scrypted.git
synced 2026-04-27 02:11:08 +01:00
server: allow plugins to customize python installs (#1542)
* server: allow plugins to customize python installs * move options inside pythonVersion
This commit is contained in:
@@ -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