2005-05-04 20:10:29 -04:00
|
|
|
#----------------------------------------------------------------------------
|
|
|
|
# Name: __init__.py
|
|
|
|
# Purpose: Utilities
|
|
|
|
#
|
|
|
|
# Author: Joel Hare
|
|
|
|
#
|
|
|
|
# Created: 7/28/04
|
|
|
|
# CVS-ID: $Id$
|
|
|
|
# Copyright: (c) 2004-2005 ActiveGrid, Inc.
|
|
|
|
# License: wxWindows License
|
|
|
|
#----------------------------------------------------------------------------
|
|
|
|
|
2005-04-08 18:54:02 -04:00
|
|
|
import traceback
|
|
|
|
import sys
|
|
|
|
import os
|
|
|
|
|
2005-06-11 19:18:57 -04:00
|
|
|
def isWindows():
|
|
|
|
return os.name == 'nt'
|
|
|
|
|
|
|
|
def _generateMainModuleDir():
|
2005-05-18 20:21:49 -04:00
|
|
|
if sys.executable.find('python') != -1:
|
|
|
|
utilModuleDir = os.path.dirname(__file__)
|
|
|
|
if not os.path.isabs(utilModuleDir):
|
|
|
|
utilModuleDir = os.path.join(os.getcwd(), utilModuleDir)
|
|
|
|
mainModuleDir = os.path.normpath(os.path.join(utilModuleDir, os.path.join(os.path.pardir, os.path.pardir)))
|
2005-05-31 17:41:11 -04:00
|
|
|
if mainModuleDir.endswith('.zip'):
|
|
|
|
mainModuleDir = os.path.dirname(mainModuleDir) # Get rid of library.zip
|
2005-05-18 20:21:49 -04:00
|
|
|
else:
|
|
|
|
mainModuleDir = os.path.dirname(sys.executable)
|
2005-06-11 19:18:57 -04:00
|
|
|
return mainModuleDir
|
|
|
|
|
|
|
|
mainModuleDir = _generateMainModuleDir()
|
|
|
|
|
|
|
|
|
|
|
|
def _generatePythonExecPath():
|
|
|
|
if sys.executable.find('python') != -1:
|
|
|
|
pythonExecPath = sys.executable
|
|
|
|
else:
|
|
|
|
pythonExecPath = os.path.join(os.path.dirname(sys.executable), '3rdparty\python2.3\python')
|
|
|
|
return pythonExecPath
|
|
|
|
|
|
|
|
pythonExecPath = _generatePythonExecPath()
|
|
|
|
|
|
|
|
def getCommandNameForExecPath(execPath):
|
|
|
|
if isWindows():
|
|
|
|
return '"%s"' % execPath
|
|
|
|
return execPath
|
2005-05-18 20:21:49 -04:00
|
|
|
|