[GRASS-SVN] r71275 - in grass/trunk/lib: python/script raster
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Jul 17 16:25:34 PDT 2017
Author: martinl
Date: 2017-07-17 16:25:34 -0700 (Mon, 17 Jul 2017)
New Revision: 71275
Modified:
grass/trunk/lib/python/script/core.py
grass/trunk/lib/python/script/task.py
grass/trunk/lib/raster/gdal.c
Log:
libraster: link against GDAL 2.2 (OSGeo4W)
Modified: grass/trunk/lib/python/script/core.py
===================================================================
--- grass/trunk/lib/python/script/core.py 2017-07-17 21:04:23 UTC (rev 71274)
+++ grass/trunk/lib/python/script/core.py 2017-07-17 23:25:34 UTC (rev 71275)
@@ -473,7 +473,7 @@
returncode = process.poll()
if _capture_stderr and returncode:
sys.stderr.write(stderr)
- return handle_errors(returncode, stdout, args, kwargs)
+ return handle_errors(returncode, stdout.decode('utf-8'), 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 21:04:23 UTC (rev 71274)
+++ grass/trunk/lib/python/script/task.py 2017-07-17 23:25:34 UTC (rev 71275)
@@ -434,7 +434,7 @@
"""Get node text"""
p = node.find(tag)
if p is not None:
- return string.join(string.split(p.text), ' ')
+ return ' '.join(p.text.split())
return default
@@ -448,18 +448,29 @@
# modify: fetch encoding from the interface description text(xml)
# e.g. <?xml version="1.0" encoding="GBK"?>
- pattern = re.compile('<\?xml[^>]*\Wencoding="([^"]*)"[^>]*\?>')
+ pattern = re.compile(b'<\?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
- xml_text_utf8 = xml_text.decode(enc).encode("utf-8")
+ 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")
+
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
@@ -504,11 +515,7 @@
raise ScriptError(_("Unable to fetch interface description for command '%(cmd)s'."
"\n\nDetails: %(det)s") % {'cmd': cmd, 'det': e})
- desc = cmdout.replace('grass-interface.dtd',
- os.path.join(os.getenv('GISBASE'),
- 'gui', 'xml',
- 'grass-interface.dtd'))
- return convert_xml_to_utf8(desc)
+ return convert_xml_to_utf8(cmdout)
def parse_interface(name, parser=processTask, blackList=None):
Modified: grass/trunk/lib/raster/gdal.c
===================================================================
--- grass/trunk/lib/raster/gdal.c 2017-07-17 21:04:23 UTC (rev 71274)
+++ grass/trunk/lib/raster/gdal.c 2017-07-17 23:25:34 UTC (rev 71275)
@@ -114,6 +114,7 @@
"libgdal1.7.0.so",
# endif
# ifdef _WIN32
+ "gdal202.dll",
"gdal201.dll",
"gdal200.dll",
"gdal111.dll",
More information about the grass-commit
mailing list