Buckets:
| ; | |
| var __importDefault = (this && this.__importDefault) || function (mod) { | |
| return (mod && mod.__esModule) ? mod : { "default": mod }; | |
| }; | |
| Object.defineProperty(exports, "__esModule", { value: true }); | |
| exports.resolveDetachedPythonPath = exports.resolvePythonPath = void 0; | |
| const path_1 = __importDefault(require("path")); | |
| const fs_1 = __importDefault(require("fs")); | |
| const paths_1 = require("./paths"); | |
| const isWindows = process.platform === 'win32'; | |
| // Shared resolver used by both the cron worker and Next.js API routes | |
| // so the Python interpreter is configured in exactly one place. | |
| const resolvePythonPath = () => { | |
| const candidates = []; | |
| if (isWindows) { | |
| candidates.push(path_1.default.join(paths_1.TOOLKIT_ROOT, '.venv', 'Scripts', 'python.exe')); | |
| candidates.push(path_1.default.join(paths_1.TOOLKIT_ROOT, 'venv', 'Scripts', 'python.exe')); | |
| } | |
| else { | |
| candidates.push(path_1.default.join(paths_1.TOOLKIT_ROOT, '.venv', 'bin', 'python')); | |
| candidates.push(path_1.default.join(paths_1.TOOLKIT_ROOT, 'venv', 'bin', 'python')); | |
| } | |
| for (const candidate of candidates) { | |
| if (fs_1.default.existsSync(candidate)) { | |
| return candidate; | |
| } | |
| } | |
| return isWindows ? 'python.exe' : 'python3'; | |
| }; | |
| exports.resolvePythonPath = resolvePythonPath; | |
| // Interpreter for jobs we detach so they outlive the UI. On Windows detaching | |
| // means DETACHED_PROCESS, and Windows gives any *console* app started that way | |
| // a fresh console with a visible window. pythonw.exe is the GUI-subsystem | |
| // build, so it never gets one; stdout/stderr still go to the handles we pass. | |
| const resolveDetachedPythonPath = () => { | |
| const pythonPath = (0, exports.resolvePythonPath)(); | |
| if (!isWindows) | |
| return pythonPath; | |
| // Always take the pythonw next to the interpreter we already resolved, so | |
| // both come from the same environment. Falling back to python.exe still | |
| // works, it just shows a console window. | |
| const pythonwPath = path_1.default.join(path_1.default.dirname(pythonPath), 'pythonw.exe'); | |
| return fs_1.default.existsSync(pythonwPath) ? pythonwPath : pythonPath; | |
| }; | |
| exports.resolveDetachedPythonPath = resolveDetachedPythonPath; | |
Xet Storage Details
- Size:
- 2.23 kB
- Xet hash:
- e48665bd733ee12f7af2977eb86df49d524a01fc97bd4d797fca85a0c77ec275
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.