[Inteproxy-commits] r96 - in trunk: . inteproxy
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Wed May 16 15:09:36 CEST 2007
Author: bh
Date: 2007-05-16 15:09:35 +0200 (Wed, 16 May 2007)
New Revision: 96
Modified:
trunk/ChangeLog
trunk/inteproxy/resources.py
Log:
* inteproxy/resources.py (share_dir): When running InteProxy as an
exectuable created with py2exe, determine the value of share_dir
relative to the filename of the executable.
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2007-05-16 10:36:17 UTC (rev 95)
+++ trunk/ChangeLog 2007-05-16 13:09:35 UTC (rev 96)
@@ -1,3 +1,9 @@
+2007-05-16 Bernhard Herzog <bh at intevation.de>
+
+ * inteproxy/resources.py (share_dir): When running InteProxy as an
+ exectuable created with py2exe, determine the value of share_dir
+ relative to the filename of the executable.
+
2007-05-16 Stephan Holl <stephan.holl at intevation.de>
* doc/InteProxy-de.odt: typos
Modified: trunk/inteproxy/resources.py
===================================================================
--- trunk/inteproxy/resources.py 2007-05-16 10:36:17 UTC (rev 95)
+++ trunk/inteproxy/resources.py 2007-05-16 13:09:35 UTC (rev 96)
@@ -7,11 +7,23 @@
"""Access to resources bundled with InteProxy"""
+import sys
import os
import gettext as py_gettext
-share_dir = os.path.join(os.path.dirname(__file__), os.pardir, "share")
+# determine share_dir, the name of the directroy containing the resource
+# files like images and translations. When run directly from the source
+# tree, the share_dir can be determined from the directory containing
+# this python module. When run from a frozen windows executable created
+# with py2exe that doesn't work, but we can start from the directory
+# containing the executable.
+if getattr(sys, "frozen", None) == "windows_exe":
+ _base_dir = os.path.dirname(sys.executable)
+else:
+ _base_dir = os.path.join(os.path.dirname(__file__), os.pardir)
+share_dir = os.path.join(_base_dir, "share")
+
def gettext(message):
"""Translates the message according to the user's locale.
More information about the Inteproxy-commits
mailing list