mirror of
https://github.com/koush/scrypted.git
synced 2026-02-09 08:42:19 +00:00
25 lines
690 B
JavaScript
25 lines
690 B
JavaScript
#!/usr/bin/env node
|
|
|
|
const child_process = require('child_process');
|
|
const { PortablePython } = require('py')
|
|
const { once } = require('events');
|
|
let python;
|
|
|
|
async function pipInstall(pkg) {
|
|
const cp = child_process.spawn(python, ['-m', 'pip', 'install', pkg], { stdio: 'inherit' });
|
|
const [exitCode] = await once(cp, 'exit');
|
|
if (exitCode)
|
|
throw new Error('non-zero exit code: ' + exitCode);
|
|
}
|
|
|
|
async function installScryptedServerRequirements() {
|
|
const py = new PortablePython("3.9");
|
|
await py.install();
|
|
python = py.executablePath;
|
|
|
|
await pipInstall('debugpy');
|
|
await pipInstall('psutil').catch(() => {});
|
|
}
|
|
|
|
installScryptedServerRequirements();
|