[grass] 09/09: Port check4dev patch to Python.

Bas Couwenberg sebastic at xs4all.nl
Sun Jan 25 01:47:59 UTC 2015


This is an automated email from the git hooks/post-receive script.

sebastic-guest pushed a commit to branch experimental
in repository grass.

commit 2dc54ef6d48e0b9a967db0ee1c9ae784ccf20402
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Sun Jan 25 02:45:07 2015 +0100

    Port check4dev patch to Python.
---
 debian/patches/check4dev | 53 +++++++++++++++++++++++++++++++++++++-----------
 debian/patches/series    |  2 +-
 2 files changed, 42 insertions(+), 13 deletions(-)

diff --git a/debian/patches/check4dev b/debian/patches/check4dev
index aac7bf5..deae18b 100644
--- a/debian/patches/check4dev
+++ b/debian/patches/check4dev
@@ -1,20 +1,49 @@
 Description: Check if we have the grass include and Make files
+ GRASS 6 used a shell script for g.extension.
+ GRASS 7 reimplemented the shell script in Python.
+ .
+ The original version of this patch was made by M. Hamish Bowman,
+ and ported to Python by Bas Couwenberg.
 Author: M. Hamish Bowman <hamish.webmail at gmail.com>
+Author: Bas Couwenberg <sebastic at xs4all.nl>
 
---- a/scripts/g.extension/g.extension
-+++ b/scripts/g.extension/g.extension
-@@ -75,6 +75,14 @@ if [ "$1" != "@ARGS_PARSED@" ] ; then
-   exec g.parser "$0" "$@"
- fi
+--- a/scripts/g.extension/g.extension.py
++++ b/scripts/g.extension/g.extension.py
+@@ -122,6 +122,7 @@ import atexit
+ import shutil
+ import zipfile
+ import tempfile
++import subprocess
  
+ from urllib2 import HTTPError
+ from urllib import urlopen
+@@ -144,6 +145,20 @@ def check_progs():
+         if not grass.find_program(prog, '--help'):
+             grass.fatal(_("'%s' required. Please install '%s' first.") % (prog, prog))
+ 
++def check_pkg(pkg):
++    process = subprocess.Popen(["dpkg-query", "-l", pkg], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
++    output = process.communicate()[0]
 +
-+# check if we have the grass include and Make files
-+dpkg-query -l grass-dev | grep '^ii' > /dev/null 2> /dev/null
-+if [ $? -ne 0 ] ; then
-+   g.message -w "This module requires the \"grass-dev\" package"
-+fi
++    installed = 0
++    for line in output.split('\n'):
++        result = re.match('^ii', line)
++        if result:
++            installed = 1
++            break
 +
++    if installed == 0:
++       grass.fatal(_("This module requires the \"%s\" package.") % pkg)
 +
- # definitions
+ # expand prefix to class name
+ def expand_module_class_name(c):
+     name = { 'd'   : 'display',
+@@ -1014,6 +1029,8 @@ def main():
+     # check dependecies
+     if sys.platform != "win32":
+         check_progs()
++        # check if we have the grass include and Make files
++        check_pkg("grass-dev")
  
- SVNURL_ADDONS="$GIS_OPT_SVNURL"
+     # manage proxies
+     global PROXIES
diff --git a/debian/patches/series b/debian/patches/series
index 58642e4..1cd3f62 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,7 +1,7 @@
 www-browser
 pager
 instdir
-#check4dev
+check4dev
 wxpy3.0-compat.patch
 parameter-typo.patch
 additionally-typo.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/grass.git



More information about the Pkg-grass-devel mailing list