mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Improvements to scons build for beast.
* 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.
This commit is contained in:
committed by
Vinnie Falco
parent
4a3176e3a0
commit
6b0cec1189
41
python/beast/env/Print.py
vendored
Normal file
41
python/beast/env/Print.py
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
import textwrap
|
||||
|
||||
from beast.util import String
|
||||
from beast.util import Terminal
|
||||
|
||||
FIELD_WIDTH = 10
|
||||
LINE_WIDTH = 69
|
||||
|
||||
EMPTY_NAME = ' ' * FIELD_WIDTH
|
||||
|
||||
TEXT_WRAPPER = textwrap.TextWrapper(
|
||||
break_long_words=False,
|
||||
break_on_hyphens=False,
|
||||
width=LINE_WIDTH,
|
||||
)
|
||||
|
||||
DISPLAY_EMPTY_ENVS = True
|
||||
|
||||
def print_build_vars(name, value, same, print=print):
|
||||
"""Pretty-print values as a build configuration."""
|
||||
name = '%s' % name.rjust(FIELD_WIDTH)
|
||||
color = Terminal.blue if same else Terminal.green
|
||||
|
||||
for line in TEXT_WRAPPER.wrap(String.stringify(value, ' ')):
|
||||
print(' '.join([name, color(line)]))
|
||||
name = EMPTY_NAME
|
||||
|
||||
def print_cmd_line(s, target, source, env):
|
||||
print(EMPTY_NAME + Terminal.blue(String.stringify(target)))
|
||||
|
||||
def print_build_config(env, original, print=print):
|
||||
print('\nConfiguration:')
|
||||
for name, value in env.items():
|
||||
if value or DISPLAY_EMPTY_ENVS:
|
||||
same = (value == original[name])
|
||||
if not same:
|
||||
print('"%s" != "%s"' % (value, original[name]))
|
||||
print_build_vars(name, value, same, print=print)
|
||||
print()
|
||||
Reference in New Issue
Block a user