module files : proper cleanup on uninstall fixes #216

Conflicts:
	lib/spack/spack/test/database.py
This commit is contained in:
alalazo 2016-03-22 15:23:46 +01:00 committed by Massimiliano Culpo
parent 3c8e055ed0
commit 73b6214a13
2 changed files with 7 additions and 9 deletions

View File

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

View File

@ -211,7 +211,11 @@ def use_name(self):
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):