opendraft 1.6.2 → 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 -54
- 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,56 +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 commands
|
|
165
|
-
const possiblePaths = [
|
|
166
|
-
'opendraft', // In PATH
|
|
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
|
-
'/opt/homebrew/bin/opendraft', // Homebrew
|
|
175
|
-
'/usr/local/bin/opendraft', // System-wide
|
|
176
|
-
'/Library/Frameworks/Python.framework/Versions/3.13/bin/opendraft',
|
|
177
|
-
'/Library/Frameworks/Python.framework/Versions/3.12/bin/opendraft',
|
|
178
|
-
'/Library/Frameworks/Python.framework/Versions/3.11/bin/opendraft',
|
|
179
|
-
];
|
|
180
|
-
|
|
181
|
-
// Try each possible path
|
|
182
|
-
for (const cmdPath of possiblePaths) {
|
|
183
|
-
try {
|
|
184
|
-
if (cmdPath === 'opendraft') {
|
|
185
|
-
execSync('which opendraft', { encoding: 'utf8', stdio: 'pipe' });
|
|
186
|
-
} else {
|
|
187
|
-
execSync(`test -x "${cmdPath}"`, { encoding: 'utf8', stdio: 'pipe' });
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
const actualCmd = cmdPath === 'opendraft' ? 'opendraft' : cmdPath;
|
|
191
|
-
const proc = spawn(actualCmd, args, {
|
|
192
|
-
stdio: 'inherit',
|
|
193
|
-
env: process.env
|
|
194
|
-
});
|
|
195
|
-
proc.on('close', (code) => {
|
|
196
|
-
process.exit(code);
|
|
197
|
-
});
|
|
198
|
-
return;
|
|
199
|
-
} catch (e) {
|
|
200
|
-
// Try next path
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
// 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
|
|
205
156
|
const script = `
|
|
206
157
|
import sys
|
|
207
158
|
sys.argv = ['opendraft'] + ${JSON.stringify(args)}
|
|
@@ -220,7 +171,7 @@ main()
|
|
|
220
171
|
|
|
221
172
|
function showInstallInstructions() {
|
|
222
173
|
console.log();
|
|
223
|
-
print(`${RED}Python 3.
|
|
174
|
+
print(`${RED}Python 3.10+ is required but not found.${RESET}`);
|
|
224
175
|
console.log();
|
|
225
176
|
|
|
226
177
|
const platform = os.platform();
|
package/logs/errors.log
ADDED
|
File without changes
|
|
File without changes
|