diff --git a/lib/spack/spack/hooks/lmodmodule.py b/lib/spack/spack/hooks/lmodmodule.py deleted file mode 100644 index 6b4318b1d03d60d31efdc2839622538c444ccbb6..0000000000000000000000000000000000000000 --- 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 similarity index 84% rename from lib/spack/spack/hooks/dotkit.py rename to lib/spack/spack/hooks/module_file_generation.py index a140646e04b5cfdd3e741d0b5b03a5d2593e4302..445cea4e9114524e05bead4a61cff8b594f3a955 100644 --- a/lib/spack/spack/hooks/dotkit.py +++ b/lib/spack/spack/hooks/module_file_generation.py @@ -26,10 +26,12 @@ 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 2c88810c97cbd1a8cfbf01e52b2ddfb996c1725b..0000000000000000000000000000000000000000 --- 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 625f56b8b67ab6087ab3b2678dfda4a8ec22b1ff..cdaeef33391ec3ecf883f09b3e13489dfd8ec3a8 100644 --- a/lib/spack/spack/test/modules.py +++ b/lib/spack/spack/test/modules.py @@ -28,6 +28,7 @@ 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 @@ def setUp(self): 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 @@ def tearDown(self): 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 @@ def get_modulefile_content(self, spec): generator = self.factory(spec) generator.write() content = FILE_REGISTRY[generator.file_name].split('\n') + generator.remove() return content