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

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Aug 13 07:13:30 EDT 2010


Author: martinl
Date: 2010-08-13 11:13:30 +0000 (Fri, 13 Aug 2010)
New Revision: 43092

Modified:
   grass/trunk/scripts/g.extension/g.extension.py
Log:
g.extension: apply patch for GRASS7 if available


Modified: grass/trunk/scripts/g.extension/g.extension.py
===================================================================
--- grass/trunk/scripts/g.extension/g.extension.py	2010-08-13 11:11:43 UTC (rev 43091)
+++ grass/trunk/scripts/g.extension/g.extension.py	2010-08-13 11:13:30 UTC (rev 43092)
@@ -272,6 +272,19 @@
         grass.fatal(_("GRASS Addons '%s' not found in repository") % module)
 
     os.chdir(os.path.join(tmpdir, module))
+
+    if os.path.exists(os.path.join(tmpdir, module, 'grass7.patch')):
+        grass.message(_("Patch for GRASS 7 detected. Applying..."))
+        if not grass.find_program('patch'):
+            grass.fatal(_("Program 'patch' required. Exiting."))
+        stdin = open(os.path.join(tmpdir, module, 'grass7.patch'))
+        grass.call(['patch',
+                    '-p0'],
+                   stdin = stdin)
+        # rename manual page
+        os.rename('description.html', module + '.html')
+        grass.verbose(_("Manual renamed from 'description.html' to '%s.html'") % module)
+    
     grass.message(_("Compiling '%s'...") % module)
     if grass.call(['make',
                    'MODULE_TOPDIR=%s' % gisbase]) != 0:



More information about the grass-commit mailing list