浏览代码

g.extension: apply patch for GRASS7 if available

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@43092 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 15 年之前
父节点
当前提交
8aa3cb4b14
共有 1 个文件被更改,包括 13 次插入0 次删除
  1. 13 0
      scripts/g.extension/g.extension.py

+ 13 - 0
scripts/g.extension/g.extension.py

@@ -272,6 +272,19 @@ def install_extension(svnurl, prefix, module):
         grass.fatal(_("GRASS Addons '%s' not found in repository") % module)
         grass.fatal(_("GRASS Addons '%s' not found in repository") % module)
 
 
     os.chdir(os.path.join(tmpdir, 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)
     grass.message(_("Compiling '%s'...") % module)
     if grass.call(['make',
     if grass.call(['make',
                    'MODULE_TOPDIR=%s' % gisbase]) != 0:
                    'MODULE_TOPDIR=%s' % gisbase]) != 0: