@emend-ai/utim 1.47.8 ā 1.47.10
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/bin/utim.js +2 -86
- package/package.json +1 -1
package/bin/utim.js
CHANGED
|
@@ -154,93 +154,9 @@ function installEngine(python) {
|
|
|
154
154
|
let termuxFlags = [];
|
|
155
155
|
if (isTermux) {
|
|
156
156
|
process.stderr.write(
|
|
157
|
-
'\nš” Termux detected.
|
|
157
|
+
'\nš” Termux detected. Installing pure-Python engine...\n\n'
|
|
158
158
|
);
|
|
159
|
-
|
|
160
|
-
// Auto-configure ANDROID_API_LEVEL environment variable to prevent compiler build failures
|
|
161
|
-
try {
|
|
162
|
-
const res = spawnSync('getprop', ['ro.build.version.sdk'], { encoding: 'utf8' });
|
|
163
|
-
if (res.status === 0 && res.stdout.trim()) {
|
|
164
|
-
process.env.ANDROID_API_LEVEL = res.stdout.trim();
|
|
165
|
-
process.stderr.write(`ā Setting ANDROID_API_LEVEL=${process.env.ANDROID_API_LEVEL} for builds...\n\n`);
|
|
166
|
-
}
|
|
167
|
-
} catch (_) {}
|
|
168
|
-
|
|
169
|
-
// Step 1: Install python-cryptography and build tools via pkg to support compilation of optional dependencies (chromadb, tree-sitter, scrapy, etc.)
|
|
170
|
-
process.stderr.write('ā Installing python-cryptography and build dependencies via Termux package manager...\n\n');
|
|
171
|
-
spawnSync('pkg', ['install', '-y', 'python-cryptography', 'clang', 'make', 'rust', 'libffi', 'openssl', 'libxml2', 'libxslt', 'libcrypt'], {
|
|
172
|
-
stdio: 'inherit',
|
|
173
|
-
shell: false,
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
// Step 2: Install pydantic-core and matching pydantic v2 using an inline python script.
|
|
177
|
-
// This is 100% reliable as it first installs the precompiled Eutalix wheel, and then tells pip
|
|
178
|
-
// to install pydantic pinned to that exact pydantic-core version. This forces pip's backtracking resolver
|
|
179
|
-
// to download the compatible pydantic version from PyPI without upgrading pydantic-core and triggering compiling from source.
|
|
180
|
-
process.stderr.write('\nā Downloading and installing pre-compiled pydantic-core wheel and pydantic...\n\n');
|
|
181
|
-
const installScript = `
|
|
182
|
-
import sys, urllib.request, json, subprocess, os, platform
|
|
183
|
-
try:
|
|
184
|
-
arch = platform.machine().lower()
|
|
185
|
-
plat_map = {'aarch64': 'aarch64', 'armv7l': 'armv7l', 'armv8l': 'armv7l', 'x86_64': 'x86_64', 'i686': 'i686', 'i386': 'i686', 'amd64': 'x86_64'}
|
|
186
|
-
plat = plat_map.get(arch, arch)
|
|
187
|
-
py_tag = f"cp{sys.version_info.major}{sys.version_info.minor}"
|
|
188
|
-
url = "https://api.github.com/repos/Eutalix/android-pydantic-core/releases/latest"
|
|
189
|
-
req = urllib.request.Request(url, headers={'User-Agent': 'Mozilla/5.0'})
|
|
190
|
-
with urllib.request.urlopen(req) as r:
|
|
191
|
-
data = json.loads(r.read().decode())
|
|
192
|
-
wheel_url = None
|
|
193
|
-
wheel_filename = None
|
|
194
|
-
for asset in data.get('assets', []):
|
|
195
|
-
name = asset.get('name', '')
|
|
196
|
-
if name.endswith('.whl') and py_tag in name and plat in name:
|
|
197
|
-
wheel_url = asset.get('browser_download_url')
|
|
198
|
-
wheel_filename = name
|
|
199
|
-
break
|
|
200
|
-
if wheel_url and wheel_filename:
|
|
201
|
-
print("[+] Found wheel:", wheel_url)
|
|
202
|
-
# Save with the real wheel filename so pip can validate it correctly
|
|
203
|
-
urllib.request.urlretrieve(wheel_url, wheel_filename)
|
|
204
|
-
subprocess.run([sys.executable, "-m", "pip", "install", "--force-reinstall", wheel_filename], check=True)
|
|
205
|
-
if os.path.exists(wheel_filename):
|
|
206
|
-
os.remove(wheel_filename)
|
|
207
|
-
|
|
208
|
-
# Determine the installed pydantic-core version dynamically
|
|
209
|
-
import pydantic_core
|
|
210
|
-
ver = pydantic_core.__version__
|
|
211
|
-
print(f"[+] Installed pydantic-core version: {ver}")
|
|
212
|
-
print("[+] Installing compatible pydantic version...")
|
|
213
|
-
|
|
214
|
-
# Install pydantic pinned to the exact installed pydantic-core version to prevent upgrading
|
|
215
|
-
subprocess.run([
|
|
216
|
-
sys.executable, "-m", "pip", "install",
|
|
217
|
-
f"pydantic-core=={ver}", "pydantic",
|
|
218
|
-
"--extra-index-url", "https://eutalix.github.io/android-pydantic-core/"
|
|
219
|
-
], check=True)
|
|
220
|
-
print("[+] Successfully installed pydantic-core and matching pydantic!")
|
|
221
|
-
else:
|
|
222
|
-
print("[-] No matching wheel found for", py_tag, plat)
|
|
223
|
-
print("[*] Proceeding with standard source compilation...")
|
|
224
|
-
except Exception as e:
|
|
225
|
-
print("[-] Failed to download/install pydantic-core wheel:", e)
|
|
226
|
-
print("[*] Proceeding with standard source compilation...")
|
|
227
|
-
`;
|
|
228
|
-
spawnSync(
|
|
229
|
-
python,
|
|
230
|
-
['-c', installScript],
|
|
231
|
-
{ stdio: 'inherit', shell: false, timeout: 180000 }
|
|
232
|
-
);
|
|
233
|
-
|
|
234
|
-
// Step 4: Upgrade pip/setuptools/wheel
|
|
235
|
-
spawnSync(python, ['-m', 'pip', 'install', '--upgrade', '--quiet', 'pip', 'setuptools', 'wheel'], {
|
|
236
|
-
stdio: 'pipe', shell: false, timeout: 60000,
|
|
237
|
-
});
|
|
238
|
-
|
|
239
|
-
// Extra index as safety net for any remaining Rust-based transitive deps
|
|
240
|
-
termuxFlags = [
|
|
241
|
-
'--extra-index-url', 'https://eutalix.github.io/android-pydantic-core/',
|
|
242
|
-
'--extra-index-url', 'https://termux-user-repository.github.io/pypi/',
|
|
243
|
-
];
|
|
159
|
+
termuxFlags = ['--upgrade-strategy', 'only-if-needed'];
|
|
244
160
|
}
|
|
245
161
|
|
|
246
162
|
const spinner = createSpinner('Setting up UTIM (first run)');
|