MCPcopy Create free account
hub / github.com/Bitmessage/PyBitmessage / detectOSRelease

Function detectOSRelease

checkdeps.py:94–118  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

92}
93
94def detectOSRelease():
95 with open("/etc/os-release", 'r') as osRelease:
96 version = None
97 for line in osRelease:
98 if line.startswith("NAME="):
99 line = line.lower()
100 if "fedora" in line:
101 detectOS.result = "Fedora"
102 elif "opensuse" in line:
103 detectOS.result = "openSUSE"
104 elif "ubuntu" in line:
105 detectOS.result = "Ubuntu"
106 elif "debian" in line:
107 detectOS.result = "Debian"
108 elif "gentoo" in line or "calculate" in line:
109 detectOS.result = "Gentoo"
110 else:
111 detectOS.result = None
112 if line.startswith("VERSION_ID="):
113 try:
114 version = float(line.split("=")[1].replace("\"", ""))
115 except ValueError:
116 pass
117 if detectOS.result == "Ubuntu" and version < 14:
118 detectOS.result = "Ubuntu 12"
119
120def detectOS():
121 if detectOS.result is not None:

Callers 1

detectOSFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected