diff options
author | Massimiliano Culpo <massimiliano.culpo@googlemail.com> | 2016-10-30 20:30:51 +0100 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2016-10-30 12:30:51 -0700 |
commit | 4d35ac6a1632cbdd37b6f876b6963125a29bb776 (patch) | |
tree | 714f9a6f33aeb9c348a1633b6f71cc36965d733b | |
parent | dbd9f1c5a187d445cf92545c1ed46711ba1a4f59 (diff) | |
download | spack-4d35ac6a1632cbdd37b6f876b6963125a29bb776.tar.gz spack-4d35ac6a1632cbdd37b6f876b6963125a29bb776.tar.bz2 spack-4d35ac6a1632cbdd37b6f876b6963125a29bb776.tar.xz spack-4d35ac6a1632cbdd37b6f876b6963125a29bb776.zip |
configuration file for modules : fixed enable keyword (#2176)
- enable keyword works again
- test/modules.py : proper clean-up after tests
-rw-r--r-- | lib/spack/spack/hooks/lmodmodule.py | 35 | ||||
-rw-r--r-- | lib/spack/spack/hooks/module_file_generation.py (renamed from lib/spack/spack/hooks/dotkit.py) | 10 | ||||
-rw-r--r-- | lib/spack/spack/hooks/tclmodule.py | 35 | ||||
-rw-r--r-- | lib/spack/spack/test/modules.py | 4 |
4 files changed, 10 insertions, 74 deletions
diff --git a/lib/spack/spack/hooks/lmodmodule.py b/lib/spack/spack/hooks/lmodmodule.py deleted file mode 100644 index 6b4318b1d0..0000000000 --- a/lib/spack/spack/hooks/lmodmodule.py +++ /dev/null @@ -1,35 +0,0 @@ -############################################################################## -# Copyright (c) 2013, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# -# This file is part of Spack. -# Written by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. -# LLNL-CODE-647188 -# -# For details, see https://scalability-llnl.github.io/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 General Public License (as published by -# the Free Software Foundation) version 2.1 dated 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 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 -############################################################################## -import spack.modules - - -def post_install(pkg): - dk = spack.modules.LmodModule(pkg.spec) - dk.write() - - -def post_uninstall(pkg): - dk = spack.modules.LmodModule(pkg.spec) - dk.remove() diff --git a/lib/spack/spack/hooks/dotkit.py b/lib/spack/spack/hooks/module_file_generation.py index a140646e04..445cea4e91 100644 --- a/lib/spack/spack/hooks/dotkit.py +++ b/lib/spack/spack/hooks/module_file_generation.py @@ -26,10 +26,12 @@ import spack.modules def post_install(pkg): - dk = spack.modules.Dotkit(pkg.spec) - dk.write() + for item, cls in spack.modules.module_types.iteritems(): + generator = cls(pkg.spec) + generator.write() def post_uninstall(pkg): - dk = spack.modules.Dotkit(pkg.spec) - dk.remove() + for item, cls in spack.modules.module_types.iteritems(): + generator = cls(pkg.spec) + generator.remove() diff --git a/lib/spack/spack/hooks/tclmodule.py b/lib/spack/spack/hooks/tclmodule.py deleted file mode 100644 index 2c88810c97..0000000000 --- a/lib/spack/spack/hooks/tclmodule.py +++ /dev/null @@ -1,35 +0,0 @@ -############################################################################## -# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# -# This file is part of Spack. -# Created by Todd Gamblin, tgamblin@llnl.gov, 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 -############################################################################## -import spack.modules - - -def post_install(pkg): - dk = spack.modules.TclModule(pkg.spec) - dk.write() - - -def post_uninstall(pkg): - dk = spack.modules.TclModule(pkg.spec) - dk.remove() diff --git a/lib/spack/spack/test/modules.py b/lib/spack/spack/test/modules.py index 625f56b8b6..cdaeef3339 100644 --- a/lib/spack/spack/test/modules.py +++ b/lib/spack/spack/test/modules.py @@ -28,6 +28,7 @@ from contextlib import contextmanager import StringIO import spack.modules import spack.spec +import llnl.util.filesystem from spack.test.mock_packages_test import MockPackagesTest FILE_REGISTRY = collections.defaultdict(StringIO.StringIO) @@ -104,6 +105,7 @@ class ModuleFileGeneratorTests(MockPackagesTest): self.configuration_instance = spack.modules.CONFIGURATION self.module_types_instance = spack.modules.module_types spack.modules.open = mock_open + spack.modules.mkdirp = lambda x: None # Make sure that a non-mocked configuration will trigger an error spack.modules.CONFIGURATION = None spack.modules.module_types = {self.factory.name: self.factory} @@ -112,6 +114,7 @@ class ModuleFileGeneratorTests(MockPackagesTest): del spack.modules.open spack.modules.module_types = self.module_types_instance spack.modules.CONFIGURATION = self.configuration_instance + spack.modules.mkdirp = llnl.util.filesystem.mkdirp super(ModuleFileGeneratorTests, self).tearDown() def get_modulefile_content(self, spec): @@ -119,6 +122,7 @@ class ModuleFileGeneratorTests(MockPackagesTest): generator = self.factory(spec) generator.write() content = FILE_REGISTRY[generator.file_name].split('\n') + generator.remove() return content |