icoa-cli 2.19.81 → 2.19.82
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/dist/commands/env.js +31 -15
- package/dist/repl.js +28 -14
- package/package.json +1 -1
package/dist/commands/env.js
CHANGED
|
@@ -285,21 +285,37 @@ function showPythonInstallGuide() {
|
|
|
285
285
|
console.log();
|
|
286
286
|
let currentPy = '';
|
|
287
287
|
let pyStatus = 'missing';
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
288
|
+
// Prefer the versioned binary if available. On macOS with Homebrew, `python3`
|
|
289
|
+
// often points to the latest (e.g. 3.13) while python@3.12 is also installed
|
|
290
|
+
// at /opt/homebrew/opt/python@3.12/bin/python3.12. Don't force the user to
|
|
291
|
+
// reinstall just because the default changed.
|
|
292
|
+
const pyProbes = [
|
|
293
|
+
'python3.12 --version',
|
|
294
|
+
'/opt/homebrew/opt/python@3.12/bin/python3.12 --version',
|
|
295
|
+
'/usr/local/opt/python@3.12/bin/python3.12 --version',
|
|
296
|
+
'python3 --version',
|
|
297
|
+
];
|
|
298
|
+
for (const cmd of pyProbes) {
|
|
299
|
+
try {
|
|
300
|
+
const out = execSync(cmd, { encoding: 'utf-8', timeout: 3000 }).trim();
|
|
301
|
+
const ver = out.replace('Python ', '');
|
|
302
|
+
const parts = ver.split('.').map(Number);
|
|
303
|
+
// Only accept as "ok" if this probe returned 3.12. Otherwise keep trying.
|
|
304
|
+
if (parts[0] === 3 && parts[1] === 12) {
|
|
305
|
+
currentPy = ver;
|
|
306
|
+
pyStatus = 'ok';
|
|
307
|
+
break;
|
|
308
|
+
}
|
|
309
|
+
// Remember the last-seen version for fallback reporting
|
|
310
|
+
currentPy = ver;
|
|
311
|
+
if (parts[0] === 3 && parts[1] >= 10 && parts[1] < 12)
|
|
312
|
+
pyStatus = 'old';
|
|
313
|
+
else if (parts[0] === 3 && parts[1] > 12)
|
|
314
|
+
pyStatus = 'new';
|
|
315
|
+
else
|
|
316
|
+
pyStatus = 'missing';
|
|
317
|
+
}
|
|
318
|
+
catch { /* try next probe */ }
|
|
303
319
|
}
|
|
304
320
|
if (pyStatus === 'ok') {
|
|
305
321
|
console.log(chalk.green(` ✓ Python ${currentPy} — you're good!`));
|
package/dist/repl.js
CHANGED
|
@@ -103,21 +103,35 @@ const VERSION = '2.5.1';
|
|
|
103
103
|
// Quick Python version check (used in Selection menu startup warning).
|
|
104
104
|
// Returns {ok, version, status}. Silent/defensive — any error means 'missing'.
|
|
105
105
|
function checkPython() {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
106
|
+
// Probe python3.12 first — macOS Homebrew installs python@3.12 alongside a
|
|
107
|
+
// newer default python3, and we don't want to flag a 3.12-ready machine just
|
|
108
|
+
// because the default alias moved to 3.13.
|
|
109
|
+
const probes = [
|
|
110
|
+
'python3.12 --version',
|
|
111
|
+
'/opt/homebrew/opt/python@3.12/bin/python3.12 --version',
|
|
112
|
+
'/usr/local/opt/python@3.12/bin/python3.12 --version',
|
|
113
|
+
'python3 --version',
|
|
114
|
+
];
|
|
115
|
+
let lastVersion = '';
|
|
116
|
+
let lastStatus = 'missing';
|
|
117
|
+
for (const cmd of probes) {
|
|
118
|
+
try {
|
|
119
|
+
const out = execSyncFn(cmd, { encoding: 'utf-8', timeout: 2000 }).trim();
|
|
120
|
+
const version = out.replace('Python ', '');
|
|
121
|
+
const [maj, min] = version.split('.').map(Number);
|
|
122
|
+
if (maj === 3 && min === 12)
|
|
123
|
+
return { ok: true, version, status: 'ok' };
|
|
124
|
+
lastVersion = version;
|
|
125
|
+
if (maj === 3 && min >= 10 && min < 12)
|
|
126
|
+
lastStatus = 'old';
|
|
127
|
+
else if (maj === 3 && min > 12)
|
|
128
|
+
lastStatus = 'new';
|
|
129
|
+
else
|
|
130
|
+
lastStatus = 'missing';
|
|
131
|
+
}
|
|
132
|
+
catch { /* try next probe */ }
|
|
120
133
|
}
|
|
134
|
+
return { ok: lastStatus !== 'missing', version: lastVersion, status: lastStatus };
|
|
121
135
|
}
|
|
122
136
|
function printSelectionMenu() {
|
|
123
137
|
const stats = getDemoStats();
|