STINNER Victor <vstin...@redhat.com> added the comment:
If someone wants to implement a runtime check for musl, here is an heuristic based on ldd output and libc filenames: https://github.com/lovell/detect-libc/blob/master/lib/detect-libc.js var GLIBC = 'glibc'; var MUSL = 'musl'; // Try ldd var ldd = spawnSync('ldd', ['--version'], spawnOptions); if (ldd.status === 0 && ldd.stdout.indexOf(MUSL) !== -1) { family = MUSL; version = versionFromMuslLdd(ldd.stdout); method = 'ldd'; } else if (ldd.status === 1 && ldd.stderr.indexOf(MUSL) !== -1) { family = MUSL; version = versionFromMuslLdd(ldd.stderr); method = 'ldd'; } else { // Try filesystem (family only) var lib = safeReaddirSync('/lib'); if (lib.some(contains('-linux-gnu'))) { family = GLIBC; method = 'filesystem'; } else if (lib.some(contains('libc.musl-'))) { family = MUSL; method = 'filesystem'; } else if (lib.some(contains('ld-musl-'))) { family = MUSL; method = 'filesystem'; } else { var usrSbin = safeReaddirSync('/usr/sbin'); if (usrSbin.some(contains('glibc'))) { family = GLIBC; method = 'filesystem'; } } } ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue35537> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com