[pyzo] 63/68: Set env vars related to making it work when frozen in one place that is editable after freeze

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Wed Sep 28 09:47:16 UTC 2016


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch debian/master
in repository pyzo.

commit b13fc01d3a5e03003ae3ca68269dffbd06cd54d7
Author: Almar Klein <almar.klein at gmail.com>
Date:   Tue Sep 27 11:32:39 2016 +0200

    Set env vars related to making it work when frozen in one place that is editable after freeze
---
 pyzo/__init__.py | 13 ++++++++++---
 pyzo/__main__.py |  5 -----
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/pyzo/__init__.py b/pyzo/__init__.py
index 841c438..98e036e 100644
--- a/pyzo/__init__.py
+++ b/pyzo/__init__.py
@@ -52,6 +52,16 @@ import traceback
 if sys.version < '3':
     raise RuntimeError('Pyzo requires Python 3.x to run.')
 
+# Make each OS find platform plugins etc.
+if hasattr(sys, 'frozen') and sys.frozen:
+    app_dir = os.path.dirname(sys.executable)
+    if sys.platform.startswith('win'):
+        os.environ['QT_QPA_PLATFORM_PLUGIN_PATH'] = app_dir
+    if sys.platform.startswith('linux'):
+        os.environ['QT_XKB_CONFIG_ROOT'] = '.'
+        os.environ['FONTCONFIG_FILE'] = os.path.join(app_dir, 'source/pyzo/resources',
+                                                    'fonts/linux_fonts.conf')
+
 # Import yoton as an absolute package
 from pyzo import yotonloader
 from pyzo.util import paths
@@ -84,9 +94,6 @@ os.environ['PYZO_PREFIX'] = sys.prefix
 _is_pyqt4 = hasattr(QtCore, 'PYQT_VERSION_STR')
 os.environ['PYZO_QTLIB'] = 'PyQt4' if _is_pyqt4 else 'PySide'
 
-# Let Windows find platform plugins
-if sys.platform.startswith('win'):
-    os.environ['QT_QPA_PLATFORM_PLUGIN_PATH'] = sys.prefix
 
 class MyApp(QtWidgets.QApplication):
     """ So we an open .py files on OSX.
diff --git a/pyzo/__main__.py b/pyzo/__main__.py
index 9f6cec2..27e97e5 100755
--- a/pyzo/__main__.py
+++ b/pyzo/__main__.py
@@ -39,11 +39,6 @@ if hasattr(sys, 'frozen') and sys.frozen:
     # Enable loading from source
     sys.path.insert(0, os.path.join(app_dir, 'source'))
     sys.path.insert(0, os.path.join(app_dir, 'source/more'))
-    # Environment vars
-    if sys.platform.startswith('linux'):
-        os.environ['QT_XKB_CONFIG_ROOT'] = '.'
-        os.environ['FONTCONFIG_FILE'] = os.path.join(app_dir, 'source/pyzo',
-                                                     'resources/fonts/linux_fonts.conf')
     # Import
     import pyzo
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/pyzo.git



More information about the debian-science-commits mailing list