def platform_default():
"""Return the platform string for our execution environment.
+
+ The returned value should map to one of the SCons/Platform/*.py
+ files. Since we're architecture independent, though, we don't
+ care about the machine architecture.
"""
- if sys.platform == 'win32':
- return 'win32'
- if os.name == 'cygwin':
- return 'cygwin'
if os.name == 'posix':
+ if sys.platform == 'cygwin':
+ return 'cygwin'
return 'posix'
- return None
-
-class PlatformSpec:
- def __init__(self, name):
- self.name = name
+ elif os.name == 'os2':
+ return 'os2'
+ else:
+ return sys.platform
- def __str__(self):
- return self.name
-
-def Platform(name = platform_default()):
- """Select a canned Platform specification.
+def platform_module(name = platform_default()):
+ """Return the imported module for the platform.
This looks for a module name that matches the specified argument.
If the name is unspecified, we fetch the appropriate default for
raise SCons.Errors.UserError, "No platform named '%s'" % name
if file:
file.close()
+ return sys.modules[full_name]
+
+def DefaultToolList(name = platform_default()):
+ """Select a default tool list for the specified platform.
+ """
+ module = platform_module(name)
+ return SCons.Tool.tool_list()
+
+class PlatformSpec:
+ def __init__(self, name):
+ self.name = name
+
+ def __str__(self):
+ return self.name
+
+def Platform(name = platform_default()):
+ """Select a canned Platform specification.
+ """
+ module = platform_module(name)
spec = PlatformSpec(name)
- spec.__call__ = sys.modules[full_name].generate
+ spec.__call__ = module.generate
return spec