import { existsSync, readdirSync } from 'fs';
const VERSIONED_PYTHON_RUNTIME_FILE = /^python\d{2,}(?:\.dll|\.zip|\._pth)$/i;
export function listVersionedPythonRuntimeFiles(pythonDir) {
    if (!existsSync(pythonDir))
        return new Set();
    try {
        return new Set(readdirSync(pythonDir)
            .filter((entry) => VERSIONED_PYTHON_RUNTIME_FILE.test(entry))
            .map((entry) => entry.toLowerCase()));
    }
    catch {
        return new Set();
    }
}
export function hasVersionedPythonRuntimeFileDrift(sourcePythonDir, destPythonDir) {
    const sourceFiles = listVersionedPythonRuntimeFiles(sourcePythonDir);
    if (sourceFiles.size === 0)
        return false;
    const destFiles = listVersionedPythonRuntimeFiles(destPythonDir);
    if (destFiles.size === 0)
        return false;
    for (const file of destFiles) {
        if (!sourceFiles.has(file))
            return true;
    }
    for (const file of sourceFiles) {
        if (!destFiles.has(file))
            return true;
    }
    return false;
}
//# sourceMappingURL=python-abi.js.map