| 33 | |
| 34 | |
| 35 | def get_linux_distribution(): |
| 36 | # platform.linux_distribution() is not available in Python >= 3.8 |
| 37 | if hasattr(platform, "linux_distribution"): |
| 38 | distro = platform.linux_distribution()[0] # pylint: disable=no-member |
| 39 | else: |
| 40 | # Fall back to shelling out to lsb_release |
| 41 | result = subprocess.run( |
| 42 | "lsb_release -i -s", shell=True, check=True, stdout=subprocess.PIPE |
| 43 | ) |
| 44 | distro = result.stdout.decode("utf-8").strip() |
| 45 | |
| 46 | if not distro: |
| 47 | raise ValueError("Fail to detect distribution we are running on") |
| 48 | |
| 49 | return distro |
| 50 | |
| 51 | |
| 52 | if len(sys.argv) < 3: |