opendraft 1.6.3 → 1.6.4
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/opendraft.js +5 -48
- package/logs/errors.log +0 -0
- package/logs/opendraft.log +0 -0
- package/package.json +1 -1
package/bin/opendraft.js
CHANGED
|
@@ -80,7 +80,6 @@ function checkPython() {
|
|
|
80
80
|
'python3.12',
|
|
81
81
|
'python3.11',
|
|
82
82
|
'python3.10',
|
|
83
|
-
'python3.9',
|
|
84
83
|
'python3',
|
|
85
84
|
'python',
|
|
86
85
|
// System Python (macOS)
|
|
@@ -94,8 +93,8 @@ function checkPython() {
|
|
|
94
93
|
if (match) {
|
|
95
94
|
const major = parseInt(match[1]);
|
|
96
95
|
const minor = parseInt(match[2]);
|
|
97
|
-
// Require Python 3.
|
|
98
|
-
if (major === 3 && minor >=
|
|
96
|
+
// Require Python 3.10-3.13 (3.9 lacks packages_distributions, 3.14+ is dev/unstable)
|
|
97
|
+
if (major === 3 && minor >= 10 && minor <= 13) {
|
|
99
98
|
return { cmd, version: `${major}.${minor}` };
|
|
100
99
|
}
|
|
101
100
|
}
|
|
@@ -152,50 +151,8 @@ function installOpendraft(pythonCmd) {
|
|
|
152
151
|
}
|
|
153
152
|
|
|
154
153
|
function runOpendraft(pythonCmd, args) {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
// Get Python version to find the right Library path
|
|
158
|
-
let pyVersion = '';
|
|
159
|
-
try {
|
|
160
|
-
const versionOutput = execSync(`${pythonCmd} -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')"`, { encoding: 'utf8' }).trim();
|
|
161
|
-
pyVersion = versionOutput;
|
|
162
|
-
} catch (e) {}
|
|
163
|
-
|
|
164
|
-
// Common locations for pip-installed Python opendraft command
|
|
165
|
-
// NOTE: Do NOT include bare 'opendraft' - it may resolve to this npm wrapper and cause infinite loop
|
|
166
|
-
const possiblePaths = [
|
|
167
|
-
`${home}/.local/bin/opendraft`, // pip --user on Linux/Mac
|
|
168
|
-
`${home}/Library/Python/${pyVersion}/bin/opendraft`, // macOS user install for detected version
|
|
169
|
-
`${home}/Library/Python/3.13/bin/opendraft`, // macOS Python 3.13
|
|
170
|
-
`${home}/Library/Python/3.12/bin/opendraft`, // macOS Python 3.12
|
|
171
|
-
`${home}/Library/Python/3.11/bin/opendraft`, // macOS Python 3.11
|
|
172
|
-
`${home}/Library/Python/3.10/bin/opendraft`, // macOS Python 3.10
|
|
173
|
-
`${home}/Library/Python/3.9/bin/opendraft`, // macOS Python 3.9
|
|
174
|
-
'/Library/Frameworks/Python.framework/Versions/3.13/bin/opendraft',
|
|
175
|
-
'/Library/Frameworks/Python.framework/Versions/3.12/bin/opendraft',
|
|
176
|
-
'/Library/Frameworks/Python.framework/Versions/3.11/bin/opendraft',
|
|
177
|
-
'/Library/Frameworks/Python.framework/Versions/3.10/bin/opendraft',
|
|
178
|
-
];
|
|
179
|
-
|
|
180
|
-
// Try each possible path
|
|
181
|
-
for (const cmdPath of possiblePaths) {
|
|
182
|
-
try {
|
|
183
|
-
execSync(`test -x "${cmdPath}"`, { encoding: 'utf8', stdio: 'pipe' });
|
|
184
|
-
|
|
185
|
-
const proc = spawn(cmdPath, args, {
|
|
186
|
-
stdio: 'inherit',
|
|
187
|
-
env: process.env
|
|
188
|
-
});
|
|
189
|
-
proc.on('close', (code) => {
|
|
190
|
-
process.exit(code);
|
|
191
|
-
});
|
|
192
|
-
return;
|
|
193
|
-
} catch (e) {
|
|
194
|
-
// Try next path
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
// Fallback: run via Python with proper argument handling
|
|
154
|
+
// ALWAYS run via the verified Python to avoid version mismatches
|
|
155
|
+
// This ensures we use Python 3.10+ that was checked earlier
|
|
199
156
|
const script = `
|
|
200
157
|
import sys
|
|
201
158
|
sys.argv = ['opendraft'] + ${JSON.stringify(args)}
|
|
@@ -214,7 +171,7 @@ main()
|
|
|
214
171
|
|
|
215
172
|
function showInstallInstructions() {
|
|
216
173
|
console.log();
|
|
217
|
-
print(`${RED}Python 3.
|
|
174
|
+
print(`${RED}Python 3.10+ is required but not found.${RESET}`);
|
|
218
175
|
console.log();
|
|
219
176
|
|
|
220
177
|
const platform = os.platform();
|
package/logs/errors.log
ADDED
|
File without changes
|
|
File without changes
|