Forráskód Böngészése

Fix Cannot parse interface for module on Windows (#46)

Huidae Cho 5 éve
szülő
commit
a6c11b3179
2 módosított fájl, 7 hozzáadás és 1 törlés
  1. 6 0
      lib/python/script/core.py
  2. 1 1
      lib/python/script/task.py

+ 6 - 0
lib/python/script/core.py

@@ -261,6 +261,12 @@ def get_real_command(cmd):
         # so, lets remove extension
         if os.path.splitext(cmd)[1] == '.py':
             cmd = cmd[:-3]
+        # PATHEXT is necessary to check on Windows (force lowercase)
+        pathext = list(map(lambda x: x.lower(),
+                           os.environ['PATHEXT'].split(os.pathsep)))
+        if '.py' not in pathext:
+            # we assume that PATHEXT contains always '.py'
+            os.environ['PATHEXT'] = '.py;' + os.environ['PATHEXT']
         full_path = shutil_which(cmd + '.py')
         if full_path:
             return full_path

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

@@ -481,7 +481,7 @@ def get_interface_description(cmd):
                 cmd = os.path.splitext(cmd)[0]
 
             if cmd == 'd.rast3d':
-                sys.path.insert(0, os.path.join(os.getenv('GISBASE'), 'etc',
+                sys.path.insert(0, os.path.join(os.getenv('GISBASE'),
                                                 'gui', 'scripts'))
 
             p = Popen([sys.executable, get_real_command(cmd),