Message 83765 - Python tracker (original) (raw)
doko: thanks for your interest encouraging more formal and generic solutions to this.
For what it is worth, the current version of my patch (used in Tahoe) is here:
I had to add a special case for Arch Linux, which gets triggered after the three main cases. The cases currently are, in order:
- Parse /etc/lsb-release (fast, semi-de-facto-standard, generic, hopefully a future de-jure-standard).
- Invoke the Python Standard Library's platform.dist() (pros: fast, has lots of customized special cases for different linux distros, cons: has lots of customized special cases for different linux distros, gives bogus answers for Ubuntu and Arch Linux)
- Subprocess execute "lsb_release" (pros: a real de-jure-standard! cons: slow, and is not actually a de-facto-standard since many important Linux installations don't come by default with the package that provides the de-jure-standard "lsb_release" executable, even though they do come by default with the de-facto-semi-standard "/etc/lsb-release" file).
- Arch Linux