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
42
python/beast/util/File.py
Normal file
42
python/beast/util/File.py
Normal file
@@ -0,0 +1,42 @@
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
from beast.util import String
|
||||
|
||||
import os
|
||||
|
||||
LIBRARY_PATTERNS = 'lib%s.a', 'lib%s.dylib'
|
||||
|
||||
def first_fields_after_prefix(filename, prefix):
|
||||
with open(filename, 'r') as f:
|
||||
return String.first_fields_after_prefix(prefix, f)
|
||||
|
||||
def find_files_with_suffix(base, suffix):
|
||||
for parent, _, files in os.walk(base):
|
||||
for path in files:
|
||||
path = os.path.join(parent, path)
|
||||
if path.endswith(suffix):
|
||||
yield os.path.normpath(path)
|
||||
|
||||
def child_files(parent, files):
|
||||
return [os.path.normpath(os.path.join(parent, f)) for f in files]
|
||||
|
||||
def sibling_files(path, files):
|
||||
return child_files(os.path.dirname(path), files)
|
||||
|
||||
def replace_extension(file, ext):
|
||||
return os.path.splitext(file)[0] + ext
|
||||
|
||||
def validate_libraries(path, libraries):
|
||||
bad = []
|
||||
for lib in libraries:
|
||||
found = False
|
||||
for pat in LIBRARY_PATTERNS:
|
||||
libfile = os.path.join(path, pat % lib)
|
||||
if os.path.isfile(libfile):
|
||||
found = True
|
||||
break
|
||||
if not found:
|
||||
bad.append(libfile)
|
||||
if bad:
|
||||
libs = 'library' if len(bad) == 1 else 'libraries'
|
||||
raise Exception('Missing %s: %s' % (libs, ', '.join(bad)))
|
||||
Reference in New Issue
Block a user