@scrypted/server 0.94.5 → 0.94.6
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.
- package/package.json +1 -1
- package/python/plugin_remote.py +16 -8
package/package.json
CHANGED
package/python/plugin_remote.py
CHANGED
@@ -41,7 +41,7 @@ import rpc
|
|
41
41
|
import rpc_reader
|
42
42
|
|
43
43
|
|
44
|
-
|
44
|
+
SCRYPTED_REQUIREMENTS = """
|
45
45
|
ptpython
|
46
46
|
""".strip()
|
47
47
|
|
@@ -574,25 +574,33 @@ class PluginRemote:
|
|
574
574
|
if not os.path.exists(python_prefix):
|
575
575
|
os.makedirs(python_prefix)
|
576
576
|
|
577
|
-
str_requirements = ""
|
578
|
-
if 'requirements.txt' in zip.namelist():
|
579
|
-
str_requirements = zip.open('requirements.txt').read().decode('utf8')
|
580
577
|
|
581
|
-
|
582
|
-
|
578
|
+
def read_requirements(filename: str) -> str:
|
579
|
+
if filename in zip.namelist():
|
580
|
+
return zip.open(filename).read().decode('utf8')
|
581
|
+
return ''
|
582
|
+
|
583
|
+
str_requirements = read_requirements('requirements.txt')
|
584
|
+
str_optional_requirements = read_requirements('requirements.optional.txt')
|
585
|
+
|
586
|
+
scrypted_requirements_basename = os.path.join(
|
587
|
+
python_prefix, 'requirements.scrypted')
|
583
588
|
requirements_basename = os.path.join(
|
584
589
|
python_prefix, 'requirements')
|
590
|
+
optional_requirements_basename = os.path.join(
|
591
|
+
python_prefix, 'requirements.optional')
|
585
592
|
|
586
593
|
need_pip = True
|
587
594
|
if str_requirements:
|
588
595
|
need_pip = need_requirements(requirements_basename, str_requirements)
|
589
596
|
if not need_pip:
|
590
|
-
need_pip = need_requirements(
|
597
|
+
need_pip = need_requirements(scrypted_requirements_basename, SCRYPTED_REQUIREMENTS)
|
591
598
|
|
592
599
|
if need_pip:
|
593
600
|
remove_pip_dirs(plugin_volume)
|
594
|
-
install_with_pip(python_prefix, packageJson,
|
601
|
+
install_with_pip(python_prefix, packageJson, SCRYPTED_REQUIREMENTS, scrypted_requirements_basename, ignore_error=True)
|
595
602
|
install_with_pip(python_prefix, packageJson, str_requirements, requirements_basename, ignore_error=False)
|
603
|
+
install_with_pip(python_prefix, packageJson, str_optional_requirements, optional_requirements_basename, ignore_error=True)
|
596
604
|
else:
|
597
605
|
print('requirements.txt (up to date)')
|
598
606
|
print(str_requirements)
|