sau/sau/platforms.py

23 lines
579 B
Python

import os
import platform
import sau.errors
import sau.freebsd
import sau.gentoo
def get_platform():
platform_mod = None
if platform.system() == 'FreeBSD':
platform_mod = sau.freebsd
elif platform.system() == 'Linux':
if os.path.exists('/usr/bin/emerge'):
platform_mod = sau.gentoo
if not platform_mod:
raise sau.errors.PlatformNotSupported("System: {} Release: {} Version: {} is not supported".format(
platform.system(),
platform.release(),
platform.version()))
return platform_mod