man/check-os-release-simple.py
raw| 1 | #!/usr/bin/python |
| 2 | # SPDX-License-Identifier: MIT-0 |
| 3 | |
| 4 | import platform |
| 5 | |
| 6 | os_release = platform.freedesktop_os_release() |
| 7 | |
| 8 | pretty_name = os_release.get('PRETTY_NAME', 'Linux') |
| 9 | print(f'Running on {pretty_name!r}') |
| 10 | |
| 11 | if 'fedora' in [os_release.get('ID', 'linux'), *os_release.get('ID_LIKE', '').split()]: |
| 12 | print('Looks like Fedora!') |