[GRASS-SVN] r53519 - grass/branches/releasebranch_6_4/gui/wxpython/core
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Oct 21 03:09:18 PDT 2012
Author: martinl
Date: 2012-10-21 03:09:18 -0700 (Sun, 21 Oct 2012)
New Revision: 53519
Modified:
grass/branches/releasebranch_6_4/gui/wxpython/core/gcmd.py
grass/branches/releasebranch_6_4/gui/wxpython/core/globalvar.py
Log:
another attempt to fix #1692
(merge r53512 & r53514 & 53515 & 53516 from devbr6)
Modified: grass/branches/releasebranch_6_4/gui/wxpython/core/gcmd.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/core/gcmd.py 2012-10-21 06:39:16 UTC (rev 53518)
+++ grass/branches/releasebranch_6_4/gui/wxpython/core/gcmd.py 2012-10-21 10:09:18 UTC (rev 53519)
@@ -31,6 +31,7 @@
import signal
import locale
import traceback
+import copy
import wx
@@ -526,11 +527,17 @@
# TODO: replace ugly hack bellow
args = self.cmd
if sys.platform == 'win32' and os.path.splitext(self.cmd[0])[1] == '.py':
+ # Python GUI script should be replaced by Shell scripts
os.chdir(os.path.join(os.getenv('GISBASE'), 'etc', 'gui', 'scripts'))
args = [sys.executable, self.cmd[0]] + self.cmd[1:]
- if sys.platform == 'win32' and os.getenv('GRASS_ADDON_PATH') and \
- os.path.exists(os.path.join(os.getenv('GRASS_ADDON_PATH'), self.cmd[0] + '.bat')):
- args[0] = self.cmd[0] + '.bat'
+ if sys.platform == 'win32' and \
+ self.cmd[0] in globalvar.grassScripts[globalvar.SCT_EXT]:
+ args[0] = self.cmd[0] + globalvar.SCT_EXT
+ env = copy.deepcopy(self.env)
+ env['PATH'] = os.path.join(os.getenv('GISBASE').replace('/', '\\'), 'scripts') + \
+ os.pathsep + env['PATH']
+ else:
+ env = self.env
try:
self.module = Popen(args,
@@ -538,7 +545,7 @@
stdout = subprocess.PIPE,
stderr = subprocess.PIPE,
shell = sys.platform == "win32",
- env = self.env)
+ env = env)
except OSError, e:
self.error = str(e)
Modified: grass/branches/releasebranch_6_4/gui/wxpython/core/globalvar.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/core/globalvar.py 2012-10-21 06:39:16 UTC (rev 53518)
+++ grass/branches/releasebranch_6_4/gui/wxpython/core/globalvar.py 2012-10-21 10:09:18 UTC (rev 53519)
@@ -3,7 +3,7 @@
@brief Global variables used by wxGUI
-(C) 2007-2011 by the GRASS Development Team
+(C) 2007-2012 by the GRASS Development Team
This program is free software under the GNU General Public License
(>=v2). Read the file COPYING that comes with GRASS for details.
@@ -104,6 +104,12 @@
MAP_WINDOW_SIZE = (800, 600)
GM_WINDOW_SIZE = (500, 600)
+if sys.platform == 'win32':
+ BIN_EXT = '.exe'
+ SCT_EXT = '.bat'
+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 = {}
@@ -177,13 +181,13 @@
continue
if grassScripts: # win32
name, ext = os.path.splitext(fname)
- if ext not in ['.exe', '.bat']:
+ 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 == '.bat' 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