diff options
author | alalazo <massimiliano.culpo@googlemail.com> | 2016-03-22 15:23:46 +0100 |
---|---|---|
committer | Massimiliano Culpo <massimiliano.culpo@googlemail.com> | 2016-04-06 22:10:04 +0200 |
commit | 73b6214a13339f11dbc33b0e068c13499f139b6f (patch) | |
tree | 67d9a7470fbc41372e98c7bcd2bf891f69429c74 /lib | |
parent | 3c8e055ed04c15d6d430da7c5a60759ac91e7b03 (diff) | |
download | spack-73b6214a13339f11dbc33b0e068c13499f139b6f.tar.gz spack-73b6214a13339f11dbc33b0e068c13499f139b6f.tar.bz2 spack-73b6214a13339f11dbc33b0e068c13499f139b6f.tar.xz spack-73b6214a13339f11dbc33b0e068c13499f139b6f.zip |
module files : proper cleanup on uninstall fixes #216
Conflicts:
lib/spack/spack/test/database.py
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/cmd/module.py | 10 | ||||
-rw-r--r-- | lib/spack/spack/modules.py | 6 |
2 files changed, 7 insertions, 9 deletions
diff --git a/lib/spack/spack/cmd/module.py b/lib/spack/spack/cmd/module.py index 315d9fc926..a67f5c0c13 100644 --- a/lib/spack/spack/cmd/module.py +++ b/lib/spack/spack/cmd/module.py @@ -22,21 +22,16 @@ # along with this program; if not, write to the Free Software Foundation, # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## -import sys import os import shutil -import argparse +import sys import llnl.util.tty as tty -from llnl.util.lang import partition_list -from llnl.util.filesystem import mkdirp - import spack.cmd +from llnl.util.filesystem import mkdirp from spack.modules import module_types from spack.util.string import * -from spack.spec import Spec - description ="Manipulate modules and dotkits." @@ -98,7 +93,6 @@ def module_refresh(): cls(spec).write() - def module(parser, args): if args.module_command == 'refresh': module_refresh() diff --git a/lib/spack/spack/modules.py b/lib/spack/spack/modules.py index d797af287d..61624fbd70 100644 --- a/lib/spack/spack/modules.py +++ b/lib/spack/spack/modules.py @@ -211,7 +211,11 @@ class EnvModule(object): def remove(self): mod_file = self.file_name if os.path.exists(mod_file): - shutil.rmtree(mod_file, ignore_errors=True) + try: + os.remove(mod_file) # Remove the module file + os.removedirs(os.path.dirname(mod_file)) # Remove all the empty directories from the leaf up + except OSError: + pass # removedirs throws OSError on first non-empty directory found class Dotkit(EnvModule): |