@worca/ui 0.25.1 → 0.26.0

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@worca/ui",
3
- "version": "0.25.1",
3
+ "version": "0.26.0",
4
4
  "description": "Pipeline monitoring UI for worca-cc",
5
5
  "license": "MIT",
6
6
  "author": "Sinisha Djukic",
@@ -4,6 +4,25 @@ import { copyFileSync, mkdirSync, writeFileSync } from 'node:fs';
4
4
  import path from 'node:path';
5
5
  import { fileURLToPath } from 'node:url';
6
6
 
7
+ function findPython() {
8
+ /* Find a usable Python — prefer python3 on Unix, python on Windows. */
9
+ const candidates =
10
+ process.platform === 'win32'
11
+ ? ['python', 'python3']
12
+ : ['python3', 'python'];
13
+ for (const cmd of candidates) {
14
+ try {
15
+ execFileSync(cmd, ['--version'], {
16
+ stdio: ['ignore', 'ignore', 'ignore'],
17
+ });
18
+ return cmd;
19
+ } catch {
20
+ /* not found or not executable — try next */
21
+ }
22
+ }
23
+ return null;
24
+ }
25
+
7
26
  async function run() {
8
27
  const thisFile = fileURLToPath(new URL(import.meta.url));
9
28
  const repoRoot = path.resolve(path.dirname(thisFile), '..');
@@ -49,6 +68,14 @@ async function run() {
49
68
  const utilsDir = path.join(appDir, 'utils');
50
69
  mkdirSync(utilsDir, { recursive: true });
51
70
  const constantsOut = path.join(utilsDir, 'status-constants.js');
71
+ const python = findPython();
72
+ if (!python) {
73
+ console.error(
74
+ 'status-constants codegen failed: python not found (install Python and worca-cc)',
75
+ );
76
+ process.exitCode = 1;
77
+ return;
78
+ }
52
79
  try {
53
80
  const pyScript =
54
81
  'import json; from worca.state import status as s; ' +
@@ -62,7 +89,7 @@ async function run() {
62
89
  '"PIPELINE_ALL_TERMINAL": sorted(s.PIPELINE_ALL_TERMINAL), ' +
63
90
  '"PIPELINE_IN_FLIGHT": sorted(s.PIPELINE_IN_FLIGHT)' +
64
91
  '}))';
65
- const raw = execFileSync('python3', ['-c', pyScript], {
92
+ const raw = execFileSync(python, ['-c', pyScript], {
66
93
  cwd: path.join(repoRoot, '..'),
67
94
  encoding: 'utf8',
68
95
  });
@@ -81,7 +108,7 @@ async function run() {
81
108
  console.log('generated', path.relative(repoRoot, constantsOut));
82
109
  } catch (err) {
83
110
  console.error(
84
- 'status-constants codegen failed (is python3 + worca-cc installed?):',
111
+ `status-constants codegen failed (is ${python} + worca-cc installed?):`,
85
112
  err.message,
86
113
  );
87
114
  process.exitCode = 1;