Attached is a patch to add support for -qtlibinfix to SIP's siputils.py.
A while ago someone else on the list requested this feature:
<http://old.nabble.com/Build-PyQt-with-%22qtlibinfix%22-specified-for-Qt-libraries.-td29939267.html>
What it does is check for the value QT_LIBINFIX in mkspecs/qconfig.pri,
as that seems to be the most reliable method for auto-detecting if Qt
was configured with the -qtlibinfix option. This is what cmake does to
determine the library infix.
Any comments? Could this be added to future releases of SIP?
Ian
diff -ur sip-4.12.3/siputils.py src/siputils.py
--- sip-4.12.3//siputils.py 2011-05-09 14:33:45.000000000 -0700
+++ src/siputils.py 2011-07-15 10:08:16.000000000 -0700
@@ -579,6 +579,32 @@
elif self._threaded:
defines.append("QT_THREAD_SUPPORT")
+ # Determine if -qtlibinfix was used when configuring Qt.
+ try:
+ specd_base = self.config.qt_data_dir
+ except AttributeError:
+ specd_base = self.config.qt_dir
+
+ self.infix = ""
+ qconfig_name = os.path.join(specd_base, "mkspecs", "qconfig.pri")
+ if os.access(qconfig_name, os.F_OK):
+ try:
+ f = open(qconfig_name, "r")
+ except IOError:
+ error("Unable to open \"%s\"" % qconfig_name)
+
+ line = f.readline()
+ while line:
+ line = line.strip()
+ if line and line[0] != "#":
+ eq = line.find("=")
+ if eq > 0 and line[:eq].strip() == "QT_LIBINFIX":
+ self.infix = line[eq + 1:].strip()
+ break
+
+ line = f.readline()
+
+ f.close()
# Handle library directories.
libdir_qt = self.optional_list("LIBDIR_QT")
libdir.extend(libdir_qt)
@@ -676,11 +702,6 @@
libs.extend(self._dependent_libs(self.config.qt_lib))
# Handle header directories.
- try:
- specd_base = self.config.qt_data_dir
- except AttributeError:
- specd_base = self.config.qt_dir
-
specd = os.path.join(specd_base, "mkspecs", "default")
if not os.access(specd, os.F_OK):
@@ -785,6 +806,8 @@
(self.config.qt_version >= 0x040200 and mname == "QtAssistant")):
lib = lib + "4"
+ lib = lib + getattr(self, "infix", "")
+
return lib
def optional_list(self, name):
_______________________________________________
PyQt mailing list [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt