]> git.saurik.com Git - wxWidgets.git/blob - wxPython/samples/ide/activegrid/util/__init__.py
Fix "warning: operation on 'y' may be undefined".
[wxWidgets.git] / wxPython / samples / ide / activegrid / util / __init__.py
1 #----------------------------------------------------------------------------
2 # Name: __init__.py
3 # Purpose: Utilities
4 #
5 # Author: Joel Hare
6 #
7 # Created: 7/28/04
8 # CVS-ID: $Id$
9 # Copyright: (c) 2004-2005 ActiveGrid, Inc.
10 # License: wxWindows License
11 #----------------------------------------------------------------------------
12
13 import traceback
14 import sys
15 import os
16
17 def isWindows():
18 return os.name == 'nt'
19
20 def _generateMainModuleDir():
21 if sys.executable.find('python') != -1:
22 utilModuleDir = os.path.dirname(__file__)
23 if not os.path.isabs(utilModuleDir):
24 utilModuleDir = os.path.join(os.getcwd(), utilModuleDir)
25 mainModuleDir = os.path.normpath(os.path.join(utilModuleDir, os.path.join(os.path.pardir, os.path.pardir)))
26 if mainModuleDir.endswith('.zip'):
27 mainModuleDir = os.path.dirname(mainModuleDir) # Get rid of library.zip
28 else:
29 mainModuleDir = os.path.dirname(sys.executable)
30 return mainModuleDir
31
32 mainModuleDir = _generateMainModuleDir()
33
34
35 def _generatePythonExecPath():
36 if sys.executable.find('python') != -1:
37 pythonExecPath = sys.executable
38 else:
39 pythonExecPath = os.path.join(os.path.dirname(sys.executable), '3rdparty\python2.3\python')
40 return pythonExecPath
41
42 pythonExecPath = _generatePythonExecPath()
43
44 def getCommandNameForExecPath(execPath):
45 if isWindows():
46 return '"%s"' % execPath
47 return execPath
48