diff options
author | Simon Warta <[email protected]> | 2017-04-24 23:59:56 +0200 |
---|---|---|
committer | Simon Warta <[email protected]> | 2017-04-25 00:38:04 +0200 |
commit | 5ede186a46f3c519fc971794a9f02f65f82929ae (patch) | |
tree | e2f94701c8cba6c3a33420dcd7b507c4f9764113 /configure.py | |
parent | db347b7930df4807621aa66689a6455eae8e8fb1 (diff) |
Move os and cc validation into validate_options
Diffstat (limited to 'configure.py')
-rwxr-xr-x | configure.py | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/configure.py b/configure.py index 9cd948d2a..52fcb152a 100755 --- a/configure.py +++ b/configure.py @@ -2587,7 +2587,7 @@ def set_defaults_for_unset_options(options): # Checks user options for consistency # This method DOES NOT change options on behalf of the user but explains # why the given configuration does not work. -def validate_options(options, available_module_policies): +def validate_options(options, info_os, info_cc, available_module_policies): if options.gen_amalgamation: raise UserError("--gen-amalgamation was removed. Migrate to --amalgamation.") @@ -2597,6 +2597,14 @@ def validate_options(options, available_module_policies): if options.single_amalgamation_file and not options.amalgamation: raise UserError("--single-amalgamation-file requires --amalgamation.") + if options.os not in info_os: + raise UserError('Unknown OS "%s"; available options: %s' % ( + options.os, ' '.join(sorted(info_os.keys())))) + + if options.compiler not in info_cc: + raise UserError('Unknown compiler "%s"; available options: %s' % ( + options.compiler, ' '.join(sorted(info_cc.keys())))) + if options.module_policy and options.module_policy not in available_module_policies: raise UserError("Unknown module set %s" % options.module_policy) @@ -2687,24 +2695,14 @@ def main(argv=None): logging.info('Guessing to use compiler %s (use --cc to set)' % ( options.compiler)) - if options.compiler not in info_cc: - raise UserError('Unknown compiler "%s"; available options: %s' % ( - options.compiler, ' '.join(sorted(info_cc.keys())))) - if options.os not in info_os: - def find_canonical_os_name(os_name_variant): for (canonical_os_name, info) in info_os.items(): if os_name_variant in info.aliases: return canonical_os_name return os_name_variant # not found - options.os = find_canonical_os_name(options.os) - if options.os not in info_os: - raise UserError('Unknown OS "%s"; available options: %s' % ( - options.os, ' '.join(sorted(info_os.keys())))) - if options.cpu is None: (options.arch, options.cpu) = guess_processor(info_arch) logging.info('Guessing target processor is a %s/%s (use --cpu to set)' % ( @@ -2721,12 +2719,12 @@ def main(argv=None): else: logging.error('Unknown or unidentifiable processor "%s"' % (options.cpu)) + set_defaults_for_unset_options(options) + validate_options(options, info_os, info_cc, module_policies) + logging.info('Target is %s-%s-%s-%s' % ( options.compiler, options.os, options.arch, options.cpu)) - set_defaults_for_unset_options(options) - validate_options(options, module_policies) - cc = info_cc[options.compiler] arch = info_arch[options.arch] osinfo = info_os[options.os] |