MCPcopy Create free account
hub / github.com/dedsec1121fk/DedSec / ensure_dependencies

Function ensure_dependencies

Scripts/ButSystem.py:107–142  ·  view source on GitHub ↗

ensure_dependencies. Route handler or application helper. This docstring was expanded to make future maintenance easier. Returns: Varies.

()

Source from the content-addressed store, hash-verified

105"""
106 if isinstance(pkgs, str):
107 pkgs = [pkgs]
108 _bash("pkg update -y", capture=False)
109 _bash("pkg install -y " + " ".join(pkgs), capture=False)
110
111def ensure_dependencies():
112 # flask + werkzeug included with flask
113 """ensure_dependencies.
114
115Route handler or application helper.
116
117This docstring was expanded to make future maintenance easier.
118
119Returns:
120 Varies.
121"""
122 # flask + werkzeug included with flask
123 try:
124 import flask # noqa
125 except Exception:
126 _run([sys.executable, "-m", "pip", "install", "--upgrade", "pip", "setuptools", "wheel"], check=False)
127 _run([sys.executable, "-m", "pip", "install", "flask>=2.3"], check=False)
128
129 # cryptography (prefer termux package)
130 try:
131 import cryptography # noqa
132 except Exception:
133 if _is_termux():
134 _termux_pkg_install(["python-cryptography", "openssl"])
135 try:
136 import cryptography # noqa
137 except Exception:
138 env = os.environ.copy()
139 if _is_termux() and "ANDROID_API_LEVEL" not in env:
140 try:
141 sdk = subprocess.check_output(["getprop", "ro.build.version.sdk"], text=True).strip()
142 if sdk.isdigit():
143 env["ANDROID_API_LEVEL"] = sdk
144 except Exception:
145 pass

Callers 1

ButSystem.pyFile · 0.70

Calls 3

_runFunction · 0.70
_is_termuxFunction · 0.70
_termux_pkg_installFunction · 0.70

Tested by

no test coverage detected