mirror of
https://git.quad4.io/RNS-Things/MeshChatX.git
synced 2026-05-14 13:15:04 +00:00
fix(build-backend): improve bytecode cleanup to only remove .pyc/.pyo files if corresponding .py exists
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user