mirror of
https://github.com/eigent-ai/eigent.git
synced 2026-06-01 06:00:19 +00:00
Fix Windows path separator in venv portability
This commit is contained in:
parent
657d7f1f18
commit
fd9afeb294
3 changed files with 7 additions and 4 deletions
|
|
@ -168,6 +168,7 @@ function fixPyvenvCfgPlaceholder(pyvenvCfgPath: string): boolean {
|
|||
}
|
||||
|
||||
// Replace placeholder with actual path
|
||||
// On Windows, path.join returns paths with backslashes, which matches our placeholder format
|
||||
content = content.replace(/\{\{PREBUILT_PYTHON_DIR\}\}/g, prebuiltPythonDir);
|
||||
fs.writeFileSync(pyvenvCfgPath, content);
|
||||
log.info(`[VENV] Fixed pyvenv.cfg placeholder with: ${prebuiltPythonDir}`);
|
||||
|
|
|
|||
|
|
@ -77,7 +77,9 @@ function fixPyvenvCfg(venvPath, venvName) {
|
|||
|
||||
// Replace with placeholder that will be substituted at runtime
|
||||
// {{PREBUILT_PYTHON_DIR}} will be replaced with the actual path on user's machine
|
||||
const newHome = `{{PREBUILT_PYTHON_DIR}}/${cpythonDir}/${binDir}`;
|
||||
// Use appropriate path separator for the platform
|
||||
const pathSep = isWindowsPath ? '\\' : '/';
|
||||
const newHome = `{{PREBUILT_PYTHON_DIR}}${pathSep}${cpythonDir}${pathSep}${binDir}`;
|
||||
content = content.replace(/^home\s*=\s*.+$/m, `home = ${newHome}`);
|
||||
|
||||
// Only write if content changed
|
||||
|
|
|
|||
|
|
@ -51,13 +51,13 @@ function testVenvFix() {
|
|||
console.log(` ✅ PASS: Using placeholder correctly`);
|
||||
console.log(` Home: ${homePath}`);
|
||||
|
||||
// Verify placeholder format
|
||||
const expectedPattern = /^\{\{PREBUILT_PYTHON_DIR\}\}\/cpython-[\w\.\-]+\/(bin|Scripts)$/;
|
||||
// Verify placeholder format (accept both / and \ for cross-platform)
|
||||
const expectedPattern = /^\{\{PREBUILT_PYTHON_DIR\}\}[\/\\]cpython-[\w\.\-]+[\/\\](bin|Scripts)$/;
|
||||
if (expectedPattern.test(homePath)) {
|
||||
console.log(` ✅ PASS: Placeholder format is correct`);
|
||||
} else {
|
||||
console.log(` ⚠️ WARNING: Placeholder format might be incorrect`);
|
||||
console.log(` Expected: {{PREBUILT_PYTHON_DIR}}/cpython-X.Y.Z-platform/bin`);
|
||||
console.log(` Expected: {{PREBUILT_PYTHON_DIR}}/cpython-X.Y.Z-platform/bin (or \\ on Windows)`);
|
||||
console.log(` Got: ${homePath}`);
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue