configuration file for modules : fixed enable keyword (#2176)

- enable keyword works again
- test/modules.py : proper clean-up after tests
This commit is contained in:
Massimiliano Culpo 2016-10-30 20:30:51 +01:00 committed by Todd Gamblin
parent dbd9f1c5a1
commit 4d35ac6a16
4 changed files with 10 additions and 74 deletions

View file

@ -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()

View file

@ -26,10 +26,12 @@
def post_install(pkg): def post_install(pkg):
dk = spack.modules.Dotkit(pkg.spec) for item, cls in spack.modules.module_types.iteritems():
dk.write() generator = cls(pkg.spec)
generator.write()
def post_uninstall(pkg): def post_uninstall(pkg):
dk = spack.modules.Dotkit(pkg.spec) for item, cls in spack.modules.module_types.iteritems():
dk.remove() generator = cls(pkg.spec)
generator.remove()

View file

@ -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()

View file

@ -28,6 +28,7 @@
import StringIO import StringIO
import spack.modules import spack.modules
import spack.spec import spack.spec
import llnl.util.filesystem
from spack.test.mock_packages_test import MockPackagesTest from spack.test.mock_packages_test import MockPackagesTest
FILE_REGISTRY = collections.defaultdict(StringIO.StringIO) FILE_REGISTRY = collections.defaultdict(StringIO.StringIO)
@ -104,6 +105,7 @@ def setUp(self):
self.configuration_instance = spack.modules.CONFIGURATION self.configuration_instance = spack.modules.CONFIGURATION
self.module_types_instance = spack.modules.module_types self.module_types_instance = spack.modules.module_types
spack.modules.open = mock_open spack.modules.open = mock_open
spack.modules.mkdirp = lambda x: None
# Make sure that a non-mocked configuration will trigger an error # Make sure that a non-mocked configuration will trigger an error
spack.modules.CONFIGURATION = None spack.modules.CONFIGURATION = None
spack.modules.module_types = {self.factory.name: self.factory} spack.modules.module_types = {self.factory.name: self.factory}
@ -112,6 +114,7 @@ def tearDown(self):
del spack.modules.open del spack.modules.open
spack.modules.module_types = self.module_types_instance spack.modules.module_types = self.module_types_instance
spack.modules.CONFIGURATION = self.configuration_instance spack.modules.CONFIGURATION = self.configuration_instance
spack.modules.mkdirp = llnl.util.filesystem.mkdirp
super(ModuleFileGeneratorTests, self).tearDown() super(ModuleFileGeneratorTests, self).tearDown()
def get_modulefile_content(self, spec): def get_modulefile_content(self, spec):
@ -119,6 +122,7 @@ def get_modulefile_content(self, spec):
generator = self.factory(spec) generator = self.factory(spec)
generator.write() generator.write()
content = FILE_REGISTRY[generator.file_name].split('\n') content = FILE_REGISTRY[generator.file_name].split('\n')
generator.remove()
return content return content