mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
* Common code extracted to Python directories. * Read ~/.scons file for scons environment defaults. * Override scons settings with shell environment variables. * New "tags" for debug, nodebug, optimize, nooptimize builds. * Universal platform detection. * Default value of environment variables set through prefix dictionaries. * Check for correct Boost value and fail otherwise. * Extract git describe --tags into a preprocesor variable, -DTIP_BRANCH * More colors - blue for unchanged defaults, green for changed defaults, red for error. * Contain unit tests for non-obvious stuff. * Check to see that boost libraries have been built. * Right now, we accept both .dylib and .a versions but it'd be easy to enforce .a only.
28 lines
1011 B
Python
28 lines
1011 B
Python
from __future__ import absolute_import, division, print_function, unicode_literals
|
|
|
|
import platform
|
|
|
|
def _get_platform_string():
|
|
system = platform.system()
|
|
parts = [system]
|
|
linux = system == 'Linux'
|
|
if linux:
|
|
flavor, version, _ = platform.linux_distribution()
|
|
# Arch still has issues with the platform module
|
|
parts[0] = flavor.capitalize() or 'Archlinux'
|
|
parts.extend(version.split('.'))
|
|
elif system == 'Darwin':
|
|
ten, major, minor = platform.mac_ver()[0].split('.')
|
|
parts.extend([ten, major, minor])
|
|
elif system == 'Windows':
|
|
release, version, csd, ptype = platform.win32_ver()
|
|
parts.extend([release, version, csd, ptype])
|
|
elif system == 'FreeBSD':
|
|
# No other variables to pass with FreeBSD that Python provides and I could find
|
|
pass
|
|
else:
|
|
raise Exception("Don't understand how to build for platform " + system)
|
|
return '.'.join(parts), linux
|
|
|
|
PLATFORM, IS_LINUX = _get_platform_string()
|