[GRASS-SVN] r53513 - grass/trunk/gui/wxpython/core
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Oct 20 04:32:18 PDT 2012
Author: martinl
Date: 2012-10-20 04:32:17 -0700 (Sat, 20 Oct 2012)
New Revision: 53513
Modified:
grass/trunk/gui/wxpython/core/gcmd.py
grass/trunk/gui/wxpython/core/globalvar.py
Log:
wxGUI: define BIN/SCT_EXT
Modified: grass/trunk/gui/wxpython/core/gcmd.py
===================================================================
--- grass/trunk/gui/wxpython/core/gcmd.py 2012-10-20 10:54:47 UTC (rev 53512)
+++ grass/trunk/gui/wxpython/core/gcmd.py 2012-10-20 11:32:17 UTC (rev 53513)
@@ -528,11 +528,11 @@
# TODO: replace ugly hack bellow
args = self.cmd
if sys.platform == 'win32':
- ext = os.path.splitext(self.cmd[0])[1] == '.py'
- if ext or self.cmd[0] in globalvar.grassScripts['.py']:
+ ext = os.path.splitext(self.cmd[0])[1] == globalvar.SCT_EXT
+ if ext or self.cmd[0] in globalvar.grassScripts[globalvar.SCT_EXT]:
os.chdir(os.path.join(os.getenv('GISBASE'), 'scripts'))
if not ext:
- args = [sys.executable, self.cmd[0] + '.py'] + self.cmd[1:]
+ args = [sys.executable, self.cmd[0] + globalvar.SCT_EXT] + self.cmd[1:]
else:
args = [sys.executable, self.cmd[0]] + self.cmd[1:]
Modified: grass/trunk/gui/wxpython/core/globalvar.py
===================================================================
--- grass/trunk/gui/wxpython/core/globalvar.py 2012-10-20 10:54:47 UTC (rev 53512)
+++ grass/trunk/gui/wxpython/core/globalvar.py 2012-10-20 11:32:17 UTC (rev 53513)
@@ -104,6 +104,12 @@
MAP_WINDOW_SIZE = (800, 600)
GM_WINDOW_SIZE = (500, 600)
+if sys.platform == 'win32':
+ BIN_EXT = '.exe'
+ SCT_EXT = '.py'
+else:
+ BIN_EXT = SCT_EXT = ''
+
def GetGRASSCommands():
"""!Create list of available GRASS commands to use when parsing
string from the command line
@@ -114,9 +120,7 @@
gisbase = os.environ['GISBASE']
cmd = list()
if sys.platform == 'win32':
- scripts = { '.bat' : list(),
- '.py' : list()
- }
+ scripts = { SCT_EXT : list() }
else:
scripts = {}
@@ -182,13 +186,13 @@
if grassScripts: # win32
name, ext = os.path.splitext(fname)
if name not in grassCmd:
- if ext not in ['.exe', '.py']:
+ if ext not in [BIN_EXT, SCT_EXT]:
continue
if name not in grassCmd:
grassCmd.add(name)
Debug.msg(3, "AddOn commands: %s", name)
nCmd += 1
- if ext == '.py' and \
+ if ext == SCT_EXT and \
ext in grassScripts.keys() and \
name not in grassScripts[ext]:
grassScripts[ext].append(name)
More information about the grass-commit
mailing list