Skip to content

Instantly share code, notes, and snippets.

@pkulev
Last active August 26, 2015 17:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pkulev/62fa66de72f78c78d723 to your computer and use it in GitHub Desktop.
Save pkulev/62fa66de72f78c78d723 to your computer and use it in GitHub Desktop.
def get_running_os_name(name):
os_map = {
"linux": "linux",
"freebsd": "freebsd",
"openbsd": "openbsd",
"sunos5": "solaris",
"win32": "windows",
"darwin": "osx"}
for start in os_map:
if name.startswith(start):
return os_map[start]
return "unknown"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment