Переглянути джерело

revert accidental commit (https://trac.osgeo.org/grass/changeset/71275)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@71276 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 7 роки тому
батько
коміт
1490a11e6b
3 змінених файлів з 11 додано та 19 видалено
  1. 1 1
      lib/python/script/core.py
  2. 10 17
      lib/python/script/task.py
  3. 0 1
      lib/raster/gdal.c

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

@@ -473,7 +473,7 @@ def read_command(*args, **kwargs):
     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):

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

@@ -434,7 +434,7 @@ class processTask:
         """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 @@ def convert_xml_to_utf8(xml_text):
 
     # 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 @@ def get_interface_description(cmd):
         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):

+ 0 - 1
lib/raster/gdal.c

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