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
34
python/beast/env/ReadEnvFile.py
vendored
Normal file
34
python/beast/env/ReadEnvFile.py
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
import json
|
||||
import re
|
||||
|
||||
from beast.util import String
|
||||
from beast.util.Terminal import warn
|
||||
|
||||
ENV_LINE_MATCH = re.compile(r'(?: export \s+)? \s* ([^=\s]*) \s* = (.*)',
|
||||
re.VERBOSE)
|
||||
|
||||
def read_env_file(data, print=print):
|
||||
try:
|
||||
return json.loads(data)
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
bad_lines = []
|
||||
results = {}
|
||||
for number, raw_line in enumerate(data.splitlines()):
|
||||
line = String.remove_comment(raw_line).strip()
|
||||
if line:
|
||||
match = ENV_LINE_MATCH.match(line)
|
||||
if match:
|
||||
name, value = match.groups()
|
||||
results[name.strip()] = String.remove_quotes(value.strip())
|
||||
else:
|
||||
bad_lines.append([number, raw_line])
|
||||
if bad_lines:
|
||||
warn("Didn't understand the following environment file lines:", print)
|
||||
for number, line in bad_lines:
|
||||
print('%d. >>> %s' % (number + 1, line))
|
||||
|
||||
return results
|
||||
Reference in New Issue
Block a user