@scrypted/server 0.0.86 → 0.0.87
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of @scrypted/server might be problematic. Click here for more details.
- package/package.json +1 -1
- package/python/plugin-remote.py +8 -8
package/package.json
CHANGED
package/python/plugin-remote.py
CHANGED
|
@@ -159,16 +159,16 @@ class PluginRemote:
|
|
|
159
159
|
|
|
160
160
|
zip = zipfile.ZipFile(zipPath)
|
|
161
161
|
|
|
162
|
-
|
|
163
|
-
if not os.path.exists(
|
|
164
|
-
os.makedirs(
|
|
162
|
+
python_prefix = os.path.join(os.environ.get('SCRYPTED_PLUGIN_VOLUME'), 'python')
|
|
163
|
+
if not os.path.exists(python_prefix):
|
|
164
|
+
os.makedirs(python_prefix)
|
|
165
165
|
|
|
166
166
|
if 'requirements.txt' in zip.namelist():
|
|
167
167
|
requirements = zip.open('requirements.txt').read()
|
|
168
168
|
str_requirements = requirements.decode('utf8')
|
|
169
169
|
|
|
170
|
-
requirementstxt = os.path.join(
|
|
171
|
-
installed_requirementstxt = os.path.join(
|
|
170
|
+
requirementstxt = os.path.join(python_prefix, 'requirements.txt')
|
|
171
|
+
installed_requirementstxt = os.path.join(python_prefix, 'installed-requirements.txt')
|
|
172
172
|
|
|
173
173
|
need_pip = True
|
|
174
174
|
try:
|
|
@@ -185,8 +185,7 @@ class PluginRemote:
|
|
|
185
185
|
f.write(requirements)
|
|
186
186
|
f.close()
|
|
187
187
|
|
|
188
|
-
|
|
189
|
-
p = subprocess.Popen(['pip', 'install', '-r', requirementstxt, '--target', python_modules], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
|
188
|
+
p = subprocess.Popen(['pip', 'install', '-r', requirementstxt, '--prefix', python_prefix], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
|
190
189
|
while True:
|
|
191
190
|
line = p.stdout.readline()
|
|
192
191
|
if not line:
|
|
@@ -206,7 +205,8 @@ class PluginRemote:
|
|
|
206
205
|
print(str_requirements)
|
|
207
206
|
|
|
208
207
|
sys.path.insert(0, zipPath)
|
|
209
|
-
|
|
208
|
+
site_packages = os.path.join(python_prefix, 'lib/python3.9/site-packages')
|
|
209
|
+
sys.path.insert(0, site_packages)
|
|
210
210
|
from scrypted_sdk import sdk_init # type: ignore
|
|
211
211
|
self.systemManager = SystemManager(self.api, self.systemState)
|
|
212
212
|
self.deviceManager = DeviceManager(self.nativeIds, self.systemManager)
|