def supported_compilers(): """Return a set of names of compilers supported by Spack. See available_compilers() to get a list of all the available versions of supported compilers. """ return sorted(name for name in list_modules(spack.compilers_path))
def all_hook_modules(): modules = [] for name in list_modules(spack.paths.hooks_path): mod_name = __name__ + '.' + name path = os.path.join(spack.paths.hooks_path, name) + ".py" mod = simp.load_source(mod_name, path) modules.append(mod) return modules
def all_hook_modules(): modules = [] for name in list_modules(spack.paths.hooks_path): mod_name = __name__ + '.' + name path = os.path.join(spack.paths.hooks_path, name) + ".py" mod = simp.load_source(mod_name, path) if name == 'write_install_manifest': last_mod = mod else: modules.append(mod) # put `write_install_manifest` as the last hook to run modules.append(last_mod) return modules
def _all_platforms(): classes = [] mod_path = spack.paths.platform_path parent_module = "spack.platforms" for name in lang.list_modules(mod_path): mod_name = '%s.%s' % (parent_module, name) class_name = mod_to_class(name) mod = __import__(mod_name, fromlist=[class_name]) if not hasattr(mod, class_name): tty.die('No class %s defined in %s' % (class_name, mod_name)) cls = getattr(mod, class_name) if not inspect.isclass(cls): tty.die('%s.%s is not a class' % (mod_name, class_name)) classes.append(cls) return classes
def all_platforms(): classes = [] mod_path = spack.platform_path parent_module = "spack.platforms" for name in list_modules(mod_path): mod_name = '%s.%s' % (parent_module, name) class_name = mod_to_class(name) mod = __import__(mod_name, fromlist=[class_name]) if not hasattr(mod, class_name): tty.die('No class %s defined in %s' % (class_name, mod_name)) cls = getattr(mod, class_name) if not inspect.isclass(cls): tty.die('%s.%s is not a class' % (mod_name, class_name)) classes.append(cls) return classes
def list_classes(parent_module, mod_path): """Given a parent path (e.g., spack.platforms or spack.analyzers), use list_modules to derive the module names, and then mod_to_class to derive class names. Import the classes and return them in a list """ classes = [] for name in list_modules(mod_path): mod_name = '%s.%s' % (parent_module, name) class_name = mod_to_class(name) mod = __import__(mod_name, fromlist=[class_name]) if not hasattr(mod, class_name): tty.die('No class %s defined in %s' % (class_name, mod_name)) cls = getattr(mod, class_name) if not inspect.isclass(cls): tty.die('%s.%s is not a class' % (mod_name, class_name)) classes.append(cls) return classes
# # This file is part of Spack. # Created by Todd Gamblin, [email protected], All rights reserved. # LLNL-CODE-647188 # # For details, see https://github.com/llnl/spack # Please also see the LICENSE file for our notice and the LGPL. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License (as # published by the Free Software Foundation) version 2.1, February 1999. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and # conditions of the GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## """This module contains jsonschema files for all of Spack's YAML formats. """ from llnl.util.lang import list_modules # Automatically bring in all sub-modules __all__ = [] for mod in list_modules(__path__[0]): __import__('%s.%s' % (__name__, mod)) __all__.append(mod)
def all_hook_modules(): modules = [] for name in list_modules(spack.hooks_path): path = join_path(spack.hooks_path, name) + ".py" modules.append(imp.load_source('spack.hooks', path)) return modules