diff --git a/scripts/build-backend.js b/scripts/build-backend.js index 53ec007..678fccb 100755 --- a/scripts/build-backend.js +++ b/scripts/build-backend.js @@ -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); + } } } }