From fe301135021a9f64069a9bf2e3a074c8d4b712ef Mon Sep 17 00:00:00 2001 From: Mario Melara Date: Mon, 20 Jun 2016 10:57:10 -0700 Subject: Adding init_config back. Don't initalize config rather let compiler_find do all the work. spack compiler list and spack compilers can do the work --- lib/spack/spack/cmd/compiler.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/spack/spack/cmd/compiler.py b/lib/spack/spack/cmd/compiler.py index c95045ef85..ff26bc6ba2 100644 --- a/lib/spack/spack/cmd/compiler.py +++ b/lib/spack/spack/cmd/compiler.py @@ -76,8 +76,13 @@ def compiler_find(args): if not paths: paths = get_path('PATH') - compilers = [c for c in spack.compilers.find_compilers(*args.add_paths) - if c.spec not in spack.compilers.all_compilers(scope=args.scope)] + # Don't initialize compilers config via compilers.get_compiler_config. + # Just let compiler_find do the + # entire process and return an empty config from all_compilers + # Default for any other process is init_config=True + compilers = [c for c in spack.compilers.find_compilers(*paths) + if c.spec not in spack.compilers.all_compilers( + scope=args.scope, init_config=False)] if compilers: spack.compilers.add_compilers_to_config(compilers, scope=args.scope) n = len(compilers) -- cgit v1.2.3-70-g09d2 From 1303b5a6a9e83a572c5a02ddfde1c2353ca60d41 Mon Sep 17 00:00:00 2001 From: Mario Melara Date: Mon, 20 Jun 2016 10:57:58 -0700 Subject: Adding more init_config as args to all_compilers,all_compilers_config, and get_compiler_config --- lib/spack/spack/compilers/__init__.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/spack/spack/compilers/__init__.py b/lib/spack/spack/compilers/__init__.py index ae72b743b2..c4b41394e0 100644 --- a/lib/spack/spack/compilers/__init__.py +++ b/lib/spack/spack/compilers/__init__.py @@ -83,7 +83,7 @@ def _to_dict(compiler): return {'compiler': d} -def get_compiler_config(scope=None): +def get_compiler_config(scope=None, init_config=True): """Return the compiler configuration for the specified architecture. """ def init_compiler_config(): @@ -98,7 +98,7 @@ def get_compiler_config(scope=None): # Update the configuration if there are currently no compilers # configured. Avoid updating automatically if there ARE site # compilers configured but no user ones. - if not config: + if not config and init_config: if scope is None: # We know no compilers were configured in any scope. init_compiler_config() @@ -153,23 +153,23 @@ def remove_compiler_from_config(compiler_spec, scope=None): spack.config.update_config('compilers', filtered_compiler_config, scope) -def all_compilers_config(scope=None): +def all_compilers_config(scope=None, init_config=True): """Return a set of specs for all the compiler versions currently available to build with. These are instances of CompilerSpec. """ # Get compilers for this architecture. global _cache_config_file #Create a cache of the config file so we don't load all the time. if not _cache_config_file: - _cache_config_file = get_compiler_config(scope) + _cache_config_file = get_compiler_config(scope, init_config) return _cache_config_file else: return _cache_config_file -def all_compilers(scope=None): +def all_compilers(scope=None, init_config=True): # Return compiler specs from the merged config. return [spack.spec.CompilerSpec(s['compiler']['spec']) - for s in all_compilers_config(scope)] + for s in all_compilers_config(scope, init_config)] def default_compiler(): -- cgit v1.2.3-70-g09d2 From 88888f5ba02cd63cdd43d42912d368cb9f323557 Mon Sep 17 00:00:00 2001 From: Mario Melara Date: Mon, 20 Jun 2016 10:58:20 -0700 Subject: Got rid of unnecessary module arg --- lib/spack/spack/compilers/gcc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/spack/spack/compilers/gcc.py b/lib/spack/spack/compilers/gcc.py index 3f552eaece..2fae6688db 100644 --- a/lib/spack/spack/compilers/gcc.py +++ b/lib/spack/spack/compilers/gcc.py @@ -77,9 +77,9 @@ class Gcc(Compiler): return get_compiler_version( fc, '-dumpversion', # older gfortran versions don't have simple dumpversion output. - r'(?:GNU Fortran \(GCC\))?(\d+\.\d+(?:\.\d+)?)', module) + r'(?:GNU Fortran \(GCC\))?(\d+\.\d+(?:\.\d+)?)') @classmethod def f77_version(cls, f77): - return cls.fc_version(f77, module) + return cls.fc_version(f77) -- cgit v1.2.3-70-g09d2 From 4c4f3e974723210ca15e00e44daff3ad1e1098e7 Mon Sep 17 00:00:00 2001 From: Mario Melara Date: Mon, 20 Jun 2016 14:46:28 -0700 Subject: Add init_config to compiler_find method --- lib/spack/spack/cmd/compiler.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/spack/spack/cmd/compiler.py b/lib/spack/spack/cmd/compiler.py index ff26bc6ba2..c325628ebf 100644 --- a/lib/spack/spack/cmd/compiler.py +++ b/lib/spack/spack/cmd/compiler.py @@ -84,7 +84,8 @@ def compiler_find(args): if c.spec not in spack.compilers.all_compilers( scope=args.scope, init_config=False)] if compilers: - spack.compilers.add_compilers_to_config(compilers, scope=args.scope) + spack.compilers.add_compilers_to_config(compilers, scope=args.scope, + init_config=False) n = len(compilers) s = 's' if n > 1 else '' filename = spack.config.get_config_filename(args.scope, 'compilers') -- cgit v1.2.3-70-g09d2 From d515877d91300c6fb57e84f83011ded15737ca73 Mon Sep 17 00:00:00 2001 From: Mario Melara Date: Mon, 20 Jun 2016 14:54:26 -0700 Subject: Add init_config args in compilers/__init__ --- lib/spack/spack/compilers/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/spack/spack/compilers/__init__.py b/lib/spack/spack/compilers/__init__.py index c4b41394e0..a70d42982f 100644 --- a/lib/spack/spack/compilers/__init__.py +++ b/lib/spack/spack/compilers/__init__.py @@ -93,7 +93,7 @@ def get_compiler_config(scope=None, init_config=True): for compiler in compilers: compilers_dict.append(_to_dict(compiler)) spack.config.update_config('compilers', compilers_dict, scope=scope) - + config = spack.config.get_config('compilers', scope=scope) # Update the configuration if there are currently no compilers # configured. Avoid updating automatically if there ARE site @@ -117,14 +117,14 @@ def get_compiler_config(scope=None, init_config=True): return [] # Return empty list which we will later append to. -def add_compilers_to_config(compilers, scope=None): +def add_compilers_to_config(compilers, scope=None, init_config=True): """Add compilers to the config for the specified architecture. Arguments: - compilers: a list of Compiler objects. - scope: configuration scope to modify. """ - compiler_config = get_compiler_config(scope) + compiler_config = get_compiler_config(scope, init_config) for compiler in compilers: compiler_config.append(_to_dict(compiler)) global _cache_config_file -- cgit v1.2.3-70-g09d2