فهرست منبع

libraster: link against GDAL 2.2 (OSGeo4W)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@71275 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 7 سال پیش
والد
کامیت
8c3493007b
3فایلهای تغییر یافته به همراه19 افزوده شده و 11 حذف شده
  1. 1 1
      lib/python/script/core.py
  2. 17 10
      lib/python/script/task.py
  3. 1 0
      lib/raster/gdal.c

+ 1 - 1
lib/python/script/core.py

@@ -473,7 +473,7 @@ def read_command(*args, **kwargs):
     returncode = process.poll()
     returncode = process.poll()
     if _capture_stderr and returncode:
     if _capture_stderr and returncode:
         sys.stderr.write(stderr)
         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):
 def parse_command(*args, **kwargs):

+ 17 - 10
lib/python/script/task.py

@@ -434,7 +434,7 @@ class processTask:
         """Get node text"""
         """Get node text"""
         p = node.find(tag)
         p = node.find(tag)
         if p is not None:
         if p is not None:
-            return string.join(string.split(p.text), ' ')
+            return ' '.join(p.text.split())
 
 
         return default
         return default
 
 
@@ -448,18 +448,29 @@ def convert_xml_to_utf8(xml_text):
 
 
     # modify: fetch encoding from the interface description text(xml)
     # modify: fetch encoding from the interface description text(xml)
     # e.g. <?xml version="1.0" encoding="GBK"?>
     # 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)
     m = re.match(pattern, xml_text)
     if m is None:
     if m is None:
         return xml_text
         return xml_text
-    #
-    enc = m.groups()[0]
 
 
     # modify: change the encoding to "utf-8", for correct parsing
     # 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)
     p = re.compile('encoding="' + enc + '"', re.IGNORECASE)
     xml_text_utf8 = p.sub('encoding="utf-8"', xml_text_utf8)
     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
     return xml_text_utf8
 
 
 
 
@@ -504,11 +515,7 @@ def get_interface_description(cmd):
         raise ScriptError(_("Unable to fetch interface description for command '%(cmd)s'."
         raise ScriptError(_("Unable to fetch interface description for command '%(cmd)s'."
                              "\n\nDetails: %(det)s") % {'cmd': cmd, 'det': e})
                              "\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):
 def parse_interface(name, parser=processTask, blackList=None):

+ 1 - 0
lib/raster/gdal.c

@@ -114,6 +114,7 @@ static void load_library(void)
 	"libgdal1.7.0.so",
 	"libgdal1.7.0.so",
 # endif
 # endif
 # ifdef _WIN32
 # ifdef _WIN32
+	"gdal202.dll",        
 	"gdal201.dll",
 	"gdal201.dll",
 	"gdal200.dll",
 	"gdal200.dll",
 	"gdal111.dll",
 	"gdal111.dll",