mirror of
https://github.com/Quad4-Software/MeshChatX.git
synced 2026-08-18 09:49:09 -04:00
fix(build-backend): improve bytecode cleanup to only remove .pyc/.pyo files if corresponding .py exists
This commit is contained in:
parent
afbc80b8fa
commit
91902dda10
1 changed files with 5 additions and 1 deletions
|
|
@ -101,7 +101,11 @@ function stripPythonBytecodeArtifacts(dir) {
|
|||
stripPythonBytecodeArtifacts(full);
|
||||
}
|
||||
} else if (ent.name.endsWith(".pyc") || ent.name.endsWith(".pyo")) {
|
||||
fs.unlinkSync(full);
|
||||
const stem = ent.name.replace(/\.pyc$/i, "").replace(/\.pyo$/i, "");
|
||||
const siblingPy = path.join(dir, `${stem}.py`);
|
||||
if (fs.existsSync(siblingPy)) {
|
||||
fs.unlinkSync(full);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue