[GRASS-SVN] r71276 - in grass/trunk/lib: python/script raster

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jul 17 16:30:50 PDT 2017


Author: martinl
Date: 2017-07-17 16:30:50 -0700 (Mon, 17 Jul 2017)
New Revision: 71276

Modified:
   grass/trunk/lib/python/script/core.py
   grass/trunk/lib/python/script/task.py
   grass/trunk/lib/raster/gdal.c
Log:
revert accidental commit (r71275)

Modified: grass/trunk/lib/python/script/core.py
===================================================================
--- grass/trunk/lib/python/script/core.py	2017-07-17 23:25:34 UTC (rev 71275)
+++ grass/trunk/lib/python/script/core.py	2017-07-17 23:30:50 UTC (rev 71276)
@@ -473,7 +473,7 @@
     returncode = process.poll()
     if _capture_stderr and returncode:
         sys.stderr.write(stderr)
-    return handle_errors(returncode, stdout.decode('utf-8'), args, kwargs)
+    return handle_errors(returncode, stdout, args, kwargs)
 
 
 def parse_command(*args, **kwargs):

Modified: grass/trunk/lib/python/script/task.py
===================================================================
--- grass/trunk/lib/python/script/task.py	2017-07-17 23:25:34 UTC (rev 71275)
+++ grass/trunk/lib/python/script/task.py	2017-07-17 23:30:50 UTC (rev 71276)
@@ -434,7 +434,7 @@
         """Get node text"""
         p = node.find(tag)
         if p is not None:
-            return ' '.join(p.text.split())
+            return string.join(string.split(p.text), ' ')
 
         return default
 
@@ -448,29 +448,18 @@
 
     # modify: fetch encoding from the interface description text(xml)
     # e.g. <?xml version="1.0" encoding="GBK"?>
-    pattern = re.compile(b'<\?xml[^>]*\Wencoding="([^"]*)"[^>]*\?>')
+    pattern = re.compile('<\?xml[^>]*\Wencoding="([^"]*)"[^>]*\?>')
     m = re.match(pattern, xml_text)
     if m is None:
         return xml_text
+    #
+    enc = m.groups()[0]
 
     # modify: change the encoding to "utf-8", for correct parsing
-    if (sys.version_info > (3, 0)): # Python 3
-        enc = m.groups()[0].decode()
-        xml_text_utf8 = xml_text.decode(enc)
-    else:                           # Python 2
-        enc = m.groups()[0]
-        xml_text_utf8 = xml_text.decode(enc).encode("utf-8")
-        
+    xml_text_utf8 = xml_text.decode(enc).encode("utf-8")
     p = re.compile('encoding="' + enc + '"', re.IGNORECASE)
     xml_text_utf8 = p.sub('encoding="utf-8"', xml_text_utf8)
 
-    xml_text_utf8 = xml_text_utf8.replace(
-        'grass-interface.dtd',
-        os.path.join(os.getenv('GISBASE'),
-                     'gui', 'xml',
-                     'grass-interface.dtd')
-    )
-
     return xml_text_utf8
 
 
@@ -515,7 +504,11 @@
         raise ScriptError(_("Unable to fetch interface description for command '%(cmd)s'."
                              "\n\nDetails: %(det)s") % {'cmd': cmd, 'det': e})
 
-    return convert_xml_to_utf8(cmdout)
+    desc = cmdout.replace('grass-interface.dtd',
+                          os.path.join(os.getenv('GISBASE'),
+                                       'gui', 'xml',
+                                       'grass-interface.dtd'))
+    return convert_xml_to_utf8(desc)
 
 
 def parse_interface(name, parser=processTask, blackList=None):

Modified: grass/trunk/lib/raster/gdal.c
===================================================================
--- grass/trunk/lib/raster/gdal.c	2017-07-17 23:25:34 UTC (rev 71275)
+++ grass/trunk/lib/raster/gdal.c	2017-07-17 23:30:50 UTC (rev 71276)
@@ -114,7 +114,6 @@
 	"libgdal1.7.0.so",
 # endif
 # ifdef _WIN32
-	"gdal202.dll",        
 	"gdal201.dll",
 	"gdal200.dll",
 	"gdal111.dll",



More information about the grass-commit mailing list