@scrypted/server 0.0.85 → 0.0.86

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scrypted/server",
3
- "version": "0.0.85",
3
+ "version": "0.0.86",
4
4
  "description": "",
5
5
  "dependencies": {
6
6
  "@scrypted/sdk": "^0.0.127",
@@ -3,6 +3,7 @@ from asyncio.futures import Future
3
3
  from asyncio.streams import StreamReader, StreamWriter
4
4
  import os
5
5
  from os import sys
6
+ from sys import stderr, stdout
6
7
  more = os.path.join(os.getcwd(), 'node_modules/@scrypted/sdk')
7
8
  sys.path.insert(0, more)
8
9
  import scrypted_python.scrypted_sdk
@@ -164,13 +165,14 @@ class PluginRemote:
164
165
 
165
166
  if 'requirements.txt' in zip.namelist():
166
167
  requirements = zip.open('requirements.txt').read()
167
- str_requirements = requirements.decode('utf8');
168
+ str_requirements = requirements.decode('utf8')
168
169
 
169
170
  requirementstxt = os.path.join(python_modules, 'requirements.txt')
171
+ installed_requirementstxt = os.path.join(python_modules, 'installed-requirements.txt')
170
172
 
171
173
  need_pip = True
172
174
  try:
173
- existing = open(requirementstxt).read()
175
+ existing = open(installed_requirementstxt).read()
174
176
  need_pip = existing != str_requirements
175
177
  except:
176
178
  pass
@@ -184,8 +186,21 @@ class PluginRemote:
184
186
  f.close()
185
187
 
186
188
  # os.system('pip install -r %s --target %s' % (requirementstxt, python_modules))
187
- result = subprocess.check_output(['pip', 'install', '-r', requirementstxt, '--target', python_modules], stderr=subprocess.STDOUT, text=True)
188
- print(result)
189
+ p = subprocess.Popen(['pip', 'install', '-r', requirementstxt, '--target', python_modules], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
190
+ while True:
191
+ line = p.stdout.readline()
192
+ if not line:
193
+ break
194
+ line = line.decode('utf8').rstrip('\r\n')
195
+ print(line)
196
+ result = p.wait()
197
+ print('pip install result %s' % result)
198
+ if result:
199
+ raise Exception('non-zero result from pip %s' % result)
200
+
201
+ f = open(installed_requirementstxt, 'wb')
202
+ f.write(requirements)
203
+ f.close()
189
204
  else:
190
205
  print('requirements.txt (up to date)')
191
206
  print(str_requirements)