1import os.path, sys
2
3class ConfigurationError(Exception):
4    def __init__(self, reason):
5        Exception.__init__(self, "Configuration failed: %s" % reason)
6
7env = Environment()
8
9# sunos, aix, hpux, irix, sunos appear to be platforms known by SCons, assuming they're POSIX compliant
10Posix = ("linux", "darwin", "sunos", "aix", "hpux", "irix", "sunos", "netbsd")
11Windows = ("win32", "cygwin")
12
13if env["PLATFORM"] == "posix":
14    if sys.platform[:5] == "linux":
15        Platform = "linux"
16    elif sys.platform[:6] == "netbsd":
17	Platform = "netbsd"
18    else:
19        raise ConfigurationError("Unknown platform %s" % sys.platform)
20else:
21    if not env["PLATFORM"] in ("win32", "cygwin") + Posix:
22        raise ConfigurationError("Unknown platform %s" % env["PLATFORM"])
23    Platform = env["PLATFORM"]
24
25# Inspired by the versioning scheme followed by Qt, it seems sensible enough. There are three components: major, minor
26# and micro. Major changes with each subtraction from the API (backward-incompatible, i.e. V19 vs. V18), minor changes
27# with each addition to the API (backward-compatible), micro changes with each revision of the source code.
28ApiVer = "2.0.0"
29
30Export("Platform", "Posix", "ConfigurationError", "ApiVer")
31