|
@@ -1273,15 +1273,14 @@ def remove_modules(mlist, force=False):
|
|
removed = False
|
|
removed = False
|
|
err = list()
|
|
err = list()
|
|
for fpath in flist:
|
|
for fpath in flist:
|
|
- try:
|
|
|
|
- if force:
|
|
|
|
- grass.verbose(fpath)
|
|
|
|
- removed = True
|
|
|
|
|
|
+ grass.verbose(fpath)
|
|
|
|
+ if force:
|
|
|
|
+ try:
|
|
os.remove(fpath)
|
|
os.remove(fpath)
|
|
- else:
|
|
|
|
- print(fpath)
|
|
|
|
- except OSError:
|
|
|
|
- err.append((_("Unable to remove file '%s'") % fpath))
|
|
|
|
|
|
+ removed = True
|
|
|
|
+ except OSError:
|
|
|
|
+ msg = "Unable to remove file '%s'"
|
|
|
|
+ err.append((_(msg) % fpath))
|
|
if force and not removed:
|
|
if force and not removed:
|
|
grass.fatal(_("Extension <%s> not found") % name)
|
|
grass.fatal(_("Extension <%s> not found") % name)
|
|
|
|
|
|
@@ -1293,6 +1292,13 @@ def remove_modules(mlist, force=False):
|
|
else:
|
|
else:
|
|
remove_extension_std(name, force)
|
|
remove_extension_std(name, force)
|
|
|
|
|
|
|
|
+ # remove module libraries directories under GRASS_ADDONS/etc/{name}/*
|
|
|
|
+ libpath = os.path.join(options['prefix'], 'etc', name)
|
|
|
|
+ if os.path.isdir(libpath):
|
|
|
|
+ grass.verbose(libpath)
|
|
|
|
+ if force:
|
|
|
|
+ shutil.rmtree(libpath)
|
|
|
|
+
|
|
|
|
|
|
def remove_extension_std(name, force=False):
|
|
def remove_extension_std(name, force=False):
|
|
"""Remove extension/module expecting the standard layout"""
|
|
"""Remove extension/module expecting the standard layout"""
|
|
@@ -1305,11 +1311,16 @@ def remove_extension_std(name, force=False):
|
|
os.path.join(options['prefix'], 'docs', 'man', 'man1',
|
|
os.path.join(options['prefix'], 'docs', 'man', 'man1',
|
|
name + '.1')]:
|
|
name + '.1')]:
|
|
if os.path.isfile(fpath):
|
|
if os.path.isfile(fpath):
|
|
|
|
+ grass.verbose(fpath)
|
|
if force:
|
|
if force:
|
|
- grass.verbose(fpath)
|
|
|
|
os.remove(fpath)
|
|
os.remove(fpath)
|
|
- else:
|
|
|
|
- print(fpath)
|
|
|
|
|
|
+
|
|
|
|
+ # remove module libraries under GRASS_ADDONS/etc/{name}/*
|
|
|
|
+ libpath = os.path.join(options['prefix'], 'etc', name)
|
|
|
|
+ if os.path.isdir(libpath):
|
|
|
|
+ grass.verbose(libpath)
|
|
|
|
+ if force:
|
|
|
|
+ shutil.rmtree(libpath)
|
|
|
|
|
|
|
|
|
|
def remove_from_toolbox_xml(name):
|
|
def remove_from_toolbox_xml(name):
|