Skip to content

Commit

Permalink
server: add mechanism to force pip/npm install rerun on upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
koush committed Mar 22, 2023
1 parent ea1b394 commit 59f3c2e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
4 changes: 2 additions & 2 deletions server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion server/python/plugin_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,14 @@ def onProxySerialization(value: Any, proxyId: str):
sys.version_info[0])+"."+str(sys.version_info[1])
print('python version:', python_version)

python_versioned_directory = '%s-%s-%s' % (python_version, platform.system(), platform.machine())
SCRYPTED_BASE_VERSION = os.environ.get('SCRYPTED_BASE_VERSION')
if SCRYPTED_BASE_VERSION:
python_versioned_directory += SCRYPTED_BASE_VERSION

python_prefix = os.path.join(
plugin_volume, '%s-%s-%s' % (python_version, platform.system(), platform.machine()))
plugin_volume, python_versioned_directory)

if not os.path.exists(python_prefix):
os.makedirs(python_prefix)

Expand Down
16 changes: 10 additions & 6 deletions server/src/plugin/plugin-npm-dependencies.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
import { ensurePluginVolume } from "./plugin-volume";
import fs from 'fs';
import child_process from 'child_process';
import path from 'path';
import { once } from 'events';
import process from 'process';
import fs from 'fs';
import mkdirp from "mkdirp";
import semver from 'semver';
import os from 'os';
import path from 'path';
import process from 'process';
import rimraf from "rimraf";
import semver from 'semver';
import { ensurePluginVolume } from "./plugin-volume";

export function getPluginNodePath(name: string) {
const pluginVolume = ensurePluginVolume(name);
const nodeMajorVersion = semver.parse(process.version).major;
const nodePrefix = path.join(pluginVolume, `node${nodeMajorVersion}-${process.platform}-${process.arch}`);
let nodeVersionedDirectory = `node${nodeMajorVersion}-${process.platform}-${process.arch}`;
const scryptedBase = process.env.SCRYPTED_BASE_VERSION;
if (scryptedBase)
nodeVersionedDirectory += '-' + nodeVersionedDirectory;
const nodePrefix = path.join(pluginVolume, nodeVersionedDirectory);
return nodePrefix;
}

Expand Down

0 comments on commit 59f3c2e

Please sign in to comment.