SConstruct: shortest_name is a one-liner

This commit is contained in:
Mickey Rose 2018-06-29 16:43:33 +02:00
parent 89d0c6da19
commit b417ddf32d

View file

@ -188,13 +188,6 @@ def create_uninstall_target(env, path, is_glob=False):
]) ])
env.Alias("uninstall", "uninstall-"+path) env.Alias("uninstall", "uninstall-"+path)
def shortest_name(libs):
name = '-'*200
for lib in libs:
if len(name) > len(lib):
name = lib
return name
def rm_path(item,set,_env): def rm_path(item,set,_env):
for i in _env[set]: for i in _env[set]:
if i.startswith(item): if i.startswith(item):
@ -726,7 +719,7 @@ def FindBoost(context, prefixes, thread_flag):
if len(libItems) >= 1 and len(incItems) >= 1: if len(libItems) >= 1 and len(incItems) >= 1:
BOOST_LIB_DIR = os.path.dirname(libItems[0]) BOOST_LIB_DIR = os.path.dirname(libItems[0])
BOOST_INCLUDE_DIR = incItems[0].rstrip('boost/') BOOST_INCLUDE_DIR = incItems[0].rstrip('boost/')
shortest_lib_name = shortest_name(libItems) shortest_lib_name = min(libItems, key=len)
match = re.search(r'%s(.*)\..*' % search_lib, shortest_lib_name) match = re.search(r'%s(.*)\..*' % search_lib, shortest_lib_name)
if hasattr(match,'groups'): if hasattr(match,'groups'):
BOOST_APPEND = match.groups()[0] BOOST_APPEND = match.groups()[0]