Set Clang as the default compiler on macOS (#2225)
* Set OS-specific default compilers * Fix flake8 warnings
This commit is contained in:
		 Adam J. Stewart
					Adam J. Stewart
				
			
				
					committed by
					
						 Todd Gamblin
						Todd Gamblin
					
				
			
			
				
	
			
			
			 Todd Gamblin
						Todd Gamblin
					
				
			
						parent
						
							78154a63e8
						
					
				
				
					commit
					4e6d535058
				
			| @@ -26,7 +26,6 @@ | ||||
| system and configuring Spack to use multiple compilers. | ||||
| """ | ||||
| import imp | ||||
| import platform | ||||
|  | ||||
| from llnl.util.lang import list_modules | ||||
| from llnl.util.filesystem import join_path | ||||
| @@ -44,12 +43,6 @@ | ||||
| _other_instance_vars = ['modules', 'operating_system'] | ||||
| _cache_config_file = [] | ||||
|  | ||||
| # TODO: customize order in config file | ||||
| if platform.system() == 'Darwin': | ||||
|     _default_order = ['clang', 'gcc', 'intel'] | ||||
| else: | ||||
|     _default_order = ['gcc', 'intel', 'pgi', 'clang', 'xlc', 'nag'] | ||||
|  | ||||
|  | ||||
| def _auto_compiler_spec(function): | ||||
|     def converter(cspec_like, *args, **kwargs): | ||||
| @@ -169,18 +162,6 @@ def all_compilers(scope=None, init_config=True): | ||||
|             for s in all_compilers_config(scope, init_config)] | ||||
|  | ||||
|  | ||||
| def default_compiler(): | ||||
|     versions = [] | ||||
|     for name in _default_order: | ||||
|         versions = find(name) | ||||
|         if versions: | ||||
|             break | ||||
|     else: | ||||
|         raise NoCompilersError() | ||||
|  | ||||
|     return sorted(versions)[-1] | ||||
|  | ||||
|  | ||||
| def find_compilers(*paths): | ||||
|     """Return a list of compilers found in the suppied paths. | ||||
|        This invokes the find_compilers() method for each operating | ||||
|   | ||||
| @@ -28,9 +28,6 @@ | ||||
|  | ||||
|  | ||||
| class PreferredPackages(object): | ||||
|     # Arbitrary, but consistent | ||||
|     _default_order = {'compiler': ['gcc', 'intel', 'clang', 'pgi', 'xlc']} | ||||
|  | ||||
|     def __init__(self): | ||||
|         self.preferred = spack.config.get_config('packages') | ||||
|         self._spec_for_pkgname_cache = {} | ||||
| @@ -128,9 +125,6 @@ def _spec_for_pkgname(self, pkgname, component, second_key): | ||||
|         key = (pkgname, component, second_key) | ||||
|         if key not in self._spec_for_pkgname_cache: | ||||
|             pkglist = self._order_for_package(pkgname, component, second_key) | ||||
|             if not pkglist: | ||||
|                 if component in self._default_order: | ||||
|                     pkglist = self._default_order[component] | ||||
|             if component == 'compiler': | ||||
|                 self._spec_for_pkgname_cache[key] = \ | ||||
|                     [spack.spec.CompilerSpec(s) for s in pkglist] | ||||
|   | ||||
		Reference in New Issue
	
	Block a user