Skip to content
Snippets Groups Projects
Commit 326e8dde authored by muxator's avatar muxator
Browse files

thg: centralize the computation of the directory containing the thg main script

The invocation of os.path.dirname(os.path.realpath(__file__)) was made in two
places. We can centralize it to a single place on top of the file. In the
process, the variable can be renamed to thg_base_path.

No functional changes.
parent a1332fdb
No related branches found
No related tags found
No related merge requests found
......@@ -13,6 +13,8 @@
import os
import sys
thg_base_path = os.path.dirname(os.path.realpath(__file__))
if 'THG_OSX_APP' in os.environ:
# sys.path as created by py2app doesn't work quite right with demandimport
# Add the explicit path where PyQt4 and other libs are
......@@ -16,8 +18,7 @@
if 'THG_OSX_APP' in os.environ:
# sys.path as created by py2app doesn't work quite right with demandimport
# Add the explicit path where PyQt4 and other libs are
bundlepath = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(0, os.path.join(bundlepath, 'lib/python2.6/lib-dynload'))
sys.path.insert(0, os.path.join(thg_base_path, 'lib/python2.6/lib-dynload'))
if hasattr(sys, "frozen"):
if sys.frozen == 'windows_exe':
......@@ -104,10 +105,9 @@
'system32', 'cmd.exe')
os.environ['COMSPEC'] = comspec
else:
thgpath = os.path.dirname(os.path.realpath(__file__))
testpath = os.path.join(thgpath, 'tortoisehg')
if os.path.isdir(testpath) and thgpath not in sys.path:
sys.path.insert(0, thgpath)
testpath = os.path.join(thg_base_path, 'tortoisehg')
if os.path.isdir(testpath) and thg_base_path not in sys.path:
sys.path.insert(0, thg_base_path)
# compile .ui and .qrc for in-place use
fpath = os.path.realpath(__file__)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment