[GRASS-SVN] r47576 - grass/trunk/scripts/g.extension

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Aug 11 17:34:00 EDT 2011


Author: martinl
Date: 2011-08-11 14:34:00 -0700 (Thu, 11 Aug 2011)
New Revision: 47576

Modified:
   grass/trunk/scripts/g.extension/g.extension.py
Log:
g.extension: fix `remove` action


Modified: grass/trunk/scripts/g.extension/g.extension.py
===================================================================
--- grass/trunk/scripts/g.extension/g.extension.py	2011-08-11 21:28:55 UTC (rev 47575)
+++ grass/trunk/scripts/g.extension/g.extension.py	2011-08-11 21:34:00 UTC (rev 47576)
@@ -392,16 +392,17 @@
 
 def remove_extension():
     # is module available?
-    if not os.path.exists(os.path.join(options['prefix'], 'bin', options['extension'])):
-        grass.fatal(_("Module '%s' not found") % options['extension'])
+    bin_dir = os.path.join(options['prefix'], 'bin', options['extension'])
+    scr_dir = os.path.join(options['prefix'], 'scripts', options['extension'])
+    if not os.path.exists(bin_dir) and not os.path.exists(scr_dir):
+        grass.fatal(_("Module <%s> not found") % options['extension'])
     
-    for file in [os.path.join(options['prefix'], 'bin', options['extension']),
-                 os.path.join(options['prefix'], 'scripts', options['extension']),
-                 os.path.join(options['prefix'], 'docs', 'html', options['extension'] + '.html')]:
-        if os.path.isfile(file):
-            os.remove(file)
-                    
-    grass.message(_("'%s' successfully uninstalled.") % options['extension'])
+    for f in [bin_dir, scr_dir,
+              os.path.join(options['prefix'], 'docs', 'html', options['extension'] + '.html'),
+              os.path.join(options['prefix'], 'man', 'man1', options['extension'] + '.1')]:
+        grass.try_remove(f)
+    
+    grass.message(_("Module <%s> successfully uninstalled") % options['extension'])
 
 def create_dir(path):
     if os.path.isdir(path):



More information about the grass-commit mailing list