Commit 15a4cd8a authored by Marcel Huber's avatar Marcel Huber
Browse files

3rdparty-bin section improved

- corrected default list of libdirs to search
parent 6d3beb71
......@@ -17,6 +17,7 @@ import os
import re
from logging import getLogger
from SCons.Script import Dir, GetOption, AddOption, Exit
from SCons.Errors import UserError
logger = getLogger(__name__)
thirdPartyPackages = {}
......@@ -38,6 +39,11 @@ def getBinaryDistDir(packagename):
return thirdPartyPackages.get(packagename, {}).get('bin', '')
def assure_dir_exists(path):
if path and not os.path.isdir(path):
raise UserError("[%s] is not a valid directory, aborting!" % (path))
def collectPackages(directory, direxcludesrel=None):
packages = {}
......@@ -121,21 +127,38 @@ def postPackageCollection(env, registry, **kw):
if 'sys' not in package:
logger.error('Third party system definition for %s not found, aborting!', packagename)
path = GetOption('with-' + packagename)
_getopt_option_name = 'with-' + packagename
path = GetOption(_getopt_option_name)
if path:
baseDir = env.Dir(path)
# add first available include dir
includeDirList = os.getenv('INCLUDEDIRLIST', 'include:inc:.').split(':')
for incdir in includeDirList:
def _call_func_if_directory(base_dir, sub_dir, call_func=None):
includeDir = baseDir.Dir(incdir)
if includeDir.isdir():
_dir_to_check = os.path.join(base_dir.get_abspath(), sub_dir)
if _dir_to_check and os.path.isdir(_dir_to_check):
_dir_node = Dir(_dir_to_check)
if callable(call_func):
return True
except TypeError:
env.PrependENVPath('PATH', baseDir.Dir('bin').get_abspath())
return False
baseDir = Dir(path)
# add first available lib dir
_default_libdir_list = ':'.join(['lib' + env.getBitwidth(), 'lib', '.'])
for sub_dir in os.getenv('LIBDIRLIST', _default_libdir_list).split(':'):
if _call_func_if_directory(baseDir, sub_dir,
lambda _dir: env.AppendUnique(LIBPATH=[_dir])):
# add first available include dir
for sub_dir in os.getenv('INCLUDEDIRLIST', 'include:inc:.').split(':'):
if _call_func_if_directory(baseDir, sub_dir,
lambda _dir: env.AppendUnique(CPPPATH=[_dir])):
_call_func_if_directory(baseDir, 'bin',
lambda _dir: env.PrependENVPath('PATH', _dir.get_abspath()))
logger.debug('using package [%s](%s) in [%s]', packagename, 'sys', package['sys'].get_dir())
registry.setPackage(packagename, package['sys'], package['sys'].get_dir(), False)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment