From 89d0c6da192b5bb338086a2f97faa353b6b970ac Mon Sep 17 00:00:00 2001 From: Mickey Rose Date: Fri, 29 Jun 2018 16:24:04 +0200 Subject: [PATCH] SConstruct: change rollback_option to free function It shouldn't be a conftest. First, it doesn't act like one. Second, calling it as conf.rollback_option from within another conftest before calling context.Result confuses scons, it doesn't expect conftests to be nested and reports "error: no result" for the outer one as soon as the inner is called. --- SConstruct | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/SConstruct b/SConstruct index 6d8bf3c7e..3820c3114 100644 --- a/SConstruct +++ b/SConstruct @@ -491,6 +491,12 @@ for opt in opts.options: if opt.key not in pickle_store: pickle_store.append(opt.key) +def rollback_option(env, variable): + global opts + for item in opts.options: + if item.key == variable: + env[variable] = item.default + # Method of adding configure behavior to Scons adapted from: # http://freeorion.svn.sourceforge.net/svnroot/freeorion/trunk/FreeOrion/SConstruct preconfigured = False @@ -631,7 +637,7 @@ def parse_config(context, config, checks='--libs --cflags'): # optional deps... if tool not in env['SKIPPED_DEPS']: env['SKIPPED_DEPS'].append(tool) - conf.rollback_option(config) + rollback_option(env, config) else: # freetype and libxml2, not optional if tool not in env['MISSING_DEPS']: env['MISSING_DEPS'].append(tool) @@ -681,7 +687,7 @@ def parse_pg_config(context, config): env.Append(LIBS = lpq) else: env['SKIPPED_DEPS'].append(tool) - conf.rollback_option(config) + rollback_option(env, config) context.Result( ret ) return ret @@ -695,13 +701,6 @@ def ogr_enabled(context): context.Result( ret ) return ret -def rollback_option(context,variable): - global opts - env = context.env - for item in opts.options: - if item.key == variable: - env[variable] = item.default - def FindBoost(context, prefixes, thread_flag): """Routine to auto-find boost header dir, lib dir, and library naming structure. @@ -1200,7 +1199,6 @@ conf_tests = { 'prioritize_paths' : prioritize_paths, 'parse_pg_config' : parse_pg_config, 'ogr_enabled' : ogr_enabled, 'get_pkg_lib' : get_pkg_lib, - 'rollback_option' : rollback_option, 'icu_at_least' : icu_at_least, 'harfbuzz_version' : harfbuzz_version, 'harfbuzz_with_freetype_support': harfbuzz_with_freetype_support,