@scrypted/server 0.7.23 → 0.7.25

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.7.23",
3
+ "version": "0.7.25",
4
4
  "description": "",
5
5
  "dependencies": {
6
6
  "@mapbox/node-pre-gyp": "^1.0.10",
@@ -373,8 +373,14 @@ class PluginRemote:
373
373
  sys.version_info[0])+"."+str(sys.version_info[1])
374
374
  print('python version:', python_version)
375
375
 
376
+ python_versioned_directory = '%s-%s-%s' % (python_version, platform.system(), platform.machine())
377
+ SCRYPTED_BASE_VERSION = os.environ.get('SCRYPTED_BASE_VERSION')
378
+ if SCRYPTED_BASE_VERSION:
379
+ python_versioned_directory += SCRYPTED_BASE_VERSION
380
+
376
381
  python_prefix = os.path.join(
377
- plugin_volume, '%s-%s-%s' % (python_version, platform.system(), platform.machine()))
382
+ plugin_volume, python_versioned_directory)
383
+
378
384
  if not os.path.exists(python_prefix):
379
385
  os.makedirs(python_prefix)
380
386
 
@@ -1,13 +1,13 @@
1
1
  import asyncio
2
2
  import rpc
3
- from rpc_reader import prepare_peer_readloop
3
+ from rpc_reader import prepare_peer_readloop, RpcFileTransport
4
4
  import traceback
5
5
 
6
6
  class Bar:
7
7
  pass
8
8
 
9
9
  async def main():
10
- peer, peerReadLoop = await prepare_peer_readloop(loop, 4, 3)
10
+ peer, peerReadLoop = await prepare_peer_readloop(loop, RpcFileTransport(4, 3))
11
11
  peer.params['foo'] = 3
12
12
  jsoncopy = {}
13
13
  jsoncopy[rpc.RpcPeer.PROPERTY_JSON_COPY_SERIALIZE_CHILDREN] = True
@@ -35,8 +35,12 @@ async def main():
35
35
  test = await peer.getParam('test')
36
36
  print(test)
37
37
  try:
38
- async for c in test:
38
+ i = 0
39
+ async for c in await test():
39
40
  print(c)
41
+ if i == 5:
42
+ break
43
+ i = i + 1
40
44
  except:
41
45
  traceback.print_exc()
42
46
  print('all done iterating')
package/python/rpc.py CHANGED
@@ -79,6 +79,14 @@ class RpcProxy(object):
79
79
  raise
80
80
  raise Exception('RpcProxy is not an async iterable')
81
81
 
82
+ async def aclose(self):
83
+ if self.__dict__[RpcPeer.PROPERTY_PROXY_PROPERTIES] and 'Symbol(Symbol.asyncIterator)' in self.__dict__[RpcPeer.PROPERTY_PROXY_PROPERTIES]:
84
+ try:
85
+ return await RpcProxyMethod(self, self.__dict__[RpcPeer.PROPERTY_PROXY_PROPERTIES]['Symbol(Symbol.asyncIterator)']['return'])()
86
+ except RPCResultError as e:
87
+ pass
88
+ raise Exception('RpcProxy is not an async iterable')
89
+
82
90
  def __getattr__(self, name):
83
91
  if name == '__proxy_finalizer_id':
84
92
  return self.dict['__proxy_entry']['finalizerId']
@@ -1,18 +1,22 @@
1
- import { ensurePluginVolume } from "./plugin-volume";
2
- import fs from 'fs';
3
1
  import child_process from 'child_process';
4
- import path from 'path';
5
2
  import { once } from 'events';
6
- import process from 'process';
3
+ import fs from 'fs';
7
4
  import mkdirp from "mkdirp";
8
- import semver from 'semver';
9
5
  import os from 'os';
6
+ import path from 'path';
7
+ import process from 'process';
10
8
  import rimraf from "rimraf";
9
+ import semver from 'semver';
10
+ import { ensurePluginVolume } from "./plugin-volume";
11
11
 
12
12
  export function getPluginNodePath(name: string) {
13
13
  const pluginVolume = ensurePluginVolume(name);
14
14
  const nodeMajorVersion = semver.parse(process.version).major;
15
- const nodePrefix = path.join(pluginVolume, `node${nodeMajorVersion}-${process.platform}-${process.arch}`);
15
+ let nodeVersionedDirectory = `node${nodeMajorVersion}-${process.platform}-${process.arch}`;
16
+ const scryptedBase = process.env.SCRYPTED_BASE_VERSION;
17
+ if (scryptedBase)
18
+ nodeVersionedDirectory += '-' + nodeVersionedDirectory;
19
+ const nodePrefix = path.join(pluginVolume, nodeVersionedDirectory);
16
20
  return nodePrefix;
17
21
  }
18
22
 
@@ -1,9 +1,8 @@
1
1
  import child_process from 'child_process';
2
+ import net from 'net';
2
3
  import path from 'path';
3
4
  import type { Readable, Writable } from "stream";
4
5
  import { createDuplexRpcPeer } from '../src/rpc-serializer';
5
- import assert from 'assert';
6
- import net from 'net';
7
6
 
8
7
  async function main() {
9
8
  const server = net.createServer(client => {
@@ -21,12 +20,17 @@ async function main() {
21
20
  const rpcPeer = createDuplexRpcPeer('node', 'python', cp.stdio[3] as Readable, cp.stdio[4] as Writable);
22
21
 
23
22
  async function* test() {
24
- yield 1;
25
- yield 2;
26
- yield 3;
23
+ try {
24
+ for (let i = 0; ; i++) {
25
+ yield i;
26
+ }
27
+ }
28
+ finally {
29
+ console.log('closed');
30
+ }
27
31
  }
28
32
 
29
- rpcPeer.params['test'] = test();
33
+ rpcPeer.params['test'] = test;
30
34
 
31
35
  // const foo = await rpcPeer.getParam('foo');
32
36
  // assert.equal(foo, 3);