Convert platform dictionary to if-else

Makes it more extendible.
This commit is contained in:
Xidorn Quan 2016-07-19 10:02:10 +10:00
parent 9eea2be09e
commit cfc27b3df5

View file

@ -135,11 +135,13 @@ def platform_dependent_defines():
if os.name == "posix":
ret.append("-DOS_POSIX=1")
ret.append({
"Linux": "-DOS_LINUX=1",
"Darwin": "-DOS_MACOSX=1",
# TODO: Windows?
}[platform.system()])
system = platform.system()
if system == "Linux":
ret.append("-DOS_LINUX=1")
elif system == "Darwin":
ret.append("-DOS_MACOSX=1")
else:
raise Exception("Unknown platform")
return ret