From 7f3ecf70d4f032e7d43d8d98a4a10a4013cbea5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Sat, 18 Jan 2014 16:48:15 +0100 Subject: [PATCH] Add sip4-tqt and python-tqt modules to the Python search path --- src/kdedistutils.py | 45 +++++++++++++++++++++++++++++++++------------ src/qtuicompiler.py | 2 +- 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/src/kdedistutils.py b/src/kdedistutils.py index 355b2eb..83c492b 100644 --- a/src/kdedistutils.py +++ b/src/kdedistutils.py @@ -39,6 +39,19 @@ from types import StringType INSTALL_LIST = 'install_log.txt' +# Trinity-specific paths +tqt_modules = [] +for m_path in sys.path: + if os.path.exists(os.path.join(m_path, 'sip4_tqt')): + m_sip_dir = os.path.join(m_path, 'sip4_tqt') + tqt_modules.insert(0, m_sip_dir) + if os.path.exists(os.path.join(m_path, 'python_tqt')): + m_pyqt_dir = os.path.join(m_path, 'python_tqt') + tqt_modules.insert(0, m_pyqt_dir) +for m_path in tqt_modules: + sys.path.insert(0, m_path) + + ########################################################################### def setup(**arg_dict): @@ -502,9 +515,9 @@ class BuildKControlModule(Command): ('kde-kcm-lib-dir=',None,'Directory for KDE kcm library files'), ('qt-inc-dir=',None,'Directory containing C++ header files for Qt'), ('qt-lib-dir=',None,'Directory containing library files for Qt'), - ('sip-dir=','/usr/lib/pyshared/python*','Directory containing the sip library files'), + ('sip-dir=',None,'Directory containing the sip library files'), ('clib=',None,'gcc library and path'), - ('pyqt-dir=','/usr/lib/pyshared/python*','PyQt module directory'), + ('pyqt-dir=',None,'PyQt module directory'), ('pytde-dir=',None,'PyTDE module directory'), ('data-dir=',None,'installation directory for data (script) files')] @@ -518,9 +531,9 @@ class BuildKControlModule(Command): self.kde_kcm_lib_dir = None self.qt_inc_dir = None self.qt_lib_dir = None - self.sip_dir = "/usr/lib/pyshared/python*" + self.sip_dir = None self.clib = None - self.pyqt_dir = "/usr/lib/pyshared/python*" + self.pyqt_dir = None self.pytde_dir = None self.data_dir = None @@ -639,7 +652,9 @@ class BuildKControlModule(Command): # PyQt dir if self.pyqt_dir is None: - self.pyqt_dir = sysconfig.get_python_lib() + self.pyqt_dir = m_pyqt_dir + if self.pyqt_dir is None: + self.pyqt_dir = os.path.join(sysconfig.get_python_lib(), 'python_tqt') if (FindFileInPaths("libqtcmodule*",[self.pyqt_dir]) is None) and (FindFileInPaths("qt*",[self.pyqt_dir]) is None): raise SystemExit, "Failed to find the PyQt directory: %s" % self.pyqt_dir self.announce("Using %s for PyQt modules" % self.pyqt_dir) @@ -653,7 +668,9 @@ class BuildKControlModule(Command): # Sip dir if self.sip_dir is None: - self.sip_dir = sysconfig.get_python_lib() + self.sip_dir = m_sip_dir + if self.sip_dir is None: + self.sip_dir = os.path.join(sysconfig.get_python_lib(), 'sip4_tqt') if (FindFileInPaths("libsip*", [self.sip_dir]) is None) and (FindFileInPaths("sip*", [self.sip_dir]) is None): raise SystemExit, "Failed to find libsip files in directory: %s" % self.sip_dir self.announce("Using %s for libsip files" % self.sip_dir) @@ -930,8 +947,8 @@ static TDECModule* return_instance( TQWidget *parent, const char *name ) { } // Inject a helper function - TQString bridge = TQString("import sip\n" - "import qt\n" + TQString bridge = TQString("from sip4_tqt import sip\n" + "from python_tqt import qt\n" "def kcontrol_bridge_" FACTORY "(parent,name):\n" " if parent!=0:\n" #if SIP_VERSION >= 0x040200 @@ -1460,9 +1477,9 @@ class BuildTdeioslave(Command): self.kde_protocol_dir = None self.qt_inc_dir = None self.qt_lib_dir = None - self.sip_dir = "/usr/lib/pyshared/python*" + self.sip_dir = None self.clib = None - self.pyqt_dir = "/usr/lib/pyshared/python*" + self.pyqt_dir = None self.pytde_dir = None self.data_dir = None @@ -1579,7 +1596,9 @@ class BuildTdeioslave(Command): # PyQt dir if self.pyqt_dir is None: - self.pyqt_dir = sysconfig.get_python_lib() + self.pyqt_dir = m_pyqt_dir + if self.pyqt_dir is None: + self.pyqt_dir = os.path.join(sysconfig.get_python_lib(), 'python_tqt') if (FindFileInPaths("libqtcmodule*",[self.pyqt_dir]) is None) and (FindFileInPaths("qt*",[self.pyqt_dir]) is None): raise SystemExit, "Failed to find the PyQt directory: %s" % self.pyqt_dir self.announce("Using %s for PyQt modules" % self.pyqt_dir) @@ -1593,7 +1612,9 @@ class BuildTdeioslave(Command): # Sip dir if self.sip_dir is None: - self.sip_dir = sysconfig.get_python_lib() + self.sip_dir = m_sip_dir + if self.sip_dir is None: + self.sip_dir = os.path.join(sysconfig.get_python_lib(), 'sip4_tqt') if (FindFileInPaths("libsip*", [self.sip_dir]) is None) and (FindFileInPaths("sip*", [self.sip_dir]) is None): raise SystemExit, "Failed to find libsip files in directory: %s" % self.sip_dir self.announce("Using %s for libsip files" % self.sip_dir) diff --git a/src/qtuicompiler.py b/src/qtuicompiler.py index 90b4eb1..b08e79c 100644 --- a/src/qtuicompiler.py +++ b/src/qtuicompiler.py @@ -17,7 +17,7 @@ import os import sys -import pyqtconfig +from python_tqt import pyqtconfig from distutils.spawn import * import traceback