Commits

David Boddie committed 3fa1bba Merge

Merged PyQt 4.9.1 (python-qt4 4.9.1-2ubuntu1) changes with the previous tip.

Comments (0)

Files changed (136)

PyQt4-Qt-Embedded-Linux-patches/configure-qws.py

 cross_sipconfig = sipconfig
 
 # Initialise the globals.
-pyqt_version = 0x040800
-pyqt_version_str = "4.8.0 (modified for cross-compilation)"
-
-sip_min_version = 0x040b02
+pyqt_version = 0x040901
+pyqt_version_str = "4.9.1 (QWS)"
+
+sip_min_version = 0x040d01
 
 qt_version = 0
 qt_edition = ""
 dbuslibs = []
 
 
-# Under Windows qmake and the Qt DLLs must be into the system PATH otherwise
-# the dynamic linker won't be able to resolve the symbols.  On other systems we
+# Under Windows qmake and the Qt DLLs must be on the system PATH otherwise the
+# dynamic linker won't be able to resolve the symbols.  On other systems we
 # assume we can just run qmake by using its full pathname.
 if sys.platform == 'win32':
     MSG_CHECK_QMAKE = "Make sure you have a working Qt v4 qmake on your PATH."
     g.add_option("--assume-shared", action="store_true", default=False,
             dest="assume_shared", help="assume that the Qt libraries have "
             "been built as shared libraries [default: check]")
+    g.add_option("-T", "--no-timestamp", action="store_true", default=False,
+            dest="no_timestamp", help="suppress timestamps in the header "
+            "comments of generated code [default: include timestamps]")
 
     if sys.platform != 'win32':
-        if sys.platform in ('linux2', 'darwin'):
+        if sys.platform in ('linux2', 'linux3', 'darwin'):
             pip_default = True
             pip_default_str = "enabled"
         else:
                 build_file=os.path.join(src_dir, "pyrcc", "pyrcc.sbf"),
                 dir="pyrcc", install_dir=opts.pyqtbindir, console=1,
                 qt=["QtCore", "QtXml"], debug=opts.debug, warnings=1,
-                universal=cfg.universal, arch=cfg.arch)
+                universal=cfg.universal, arch=cfg.arch,
+                deployment_target=cfg.deployment_target)
 
     def generate_target_default(self, mfile):
         """Generate the default target."""
             0x040602: "Qt_4_6_1",
             0x040603: "Qt_4_6_2",
             0x040700: "Qt_4_6_3",
-            0x050000: "Qt_4_7_0"
+            0x040701: "Qt_4_7_0",
+            0x040702: "Qt_4_7_1",
+            0x040800: "Qt_4_7_2",
+            0x050000: "Qt_4_8_0"
         }
 
     def check_modules(self):
 
         if opts.mwg_ssl_dir:
             ass_lib_dirs = [os.path.join(opts.mwg_ssl_dir, "lib")]
-            ass_libs = ["ssleay32", "libeay32"]
+            ass_libs = ["ssleay32", "libeay32", "QtCore"]
         else:
             ass_lib_dirs = None
-            ass_libs = None
+            ass_libs = ["QtCore"]
 
         # Note that the order in which we check is important for the
         # consolidated module - a module's dependencies must be checked first.
         pyqt_modules.append("QtCore")
 
         check_module("QtGui", "qwidget.h", "new QWidget()")
-        check_module("QtHelp", "qhelpengine.h", "new QHelpEngine(\"foo\")")
+        check_module("QtHelp", "qhelpengine.h", "new QHelpEngine(\"foo\")",
+                extra_libs=["QtCore"])
         check_module("QtMultimedia", "QAudioDeviceInfo",
                 "new QAudioDeviceInfo()")
         check_module("QtNetwork", "qhostaddress.h", "new QHostAddress()")
+        check_module("QtDBus", "qdbusconnection.h",
+                "QDBusConnection::systemBus()")
         check_module("QtDeclarative", "qdeclarativeview.h",
                 "new QDeclarativeView()")
         check_module("QtOpenGL", "qgl.h", "new QGLWidget()")
         check_module("QtSvg", "qsvgwidget.h", "new QSvgWidget()")
         check_module("QtTest", "QtTest", "QTest::qSleep(0)")
         check_module("QtWebKit", "qwebpage.h", "new QWebPage()")
-        check_module("QtXml", "qdom.h", "new QDomDocument()")
+        check_module("QtXml", "qxml.h", "new QXmlInputSource()")
         check_module("QtXmlPatterns", "qxmlname.h", "new QXmlName()")
         check_module("phonon", "phonon/videowidget.h",
                 "new Phonon::VideoWidget()")
         if "QtNetwork" in pyqt_modules:
             generate_code("QtNetwork")
 
+        if "QtDBus" in pyqt_modules:
+            qpy_inc_dir, qpy_lib_dir, qpy_lib = self._qpy_directories("QtDBus", "qpydbus")
+
+            if opts.bigqt:
+                cons_xtra_incdirs.append(qpy_inc_dir)
+                cons_xtra_libdirs.append(qpy_lib_dir)
+                cons_xtra_libs.append(qpy_lib)
+
+                generate_code("QtDBus")
+            else:
+                generate_code("QtDBus", extra_include_dirs=[qpy_inc_dir],
+                        extra_lib_dirs=[qpy_lib_dir], extra_libs=[qpy_lib])
+
         if "QtOpenGL" in pyqt_modules:
             generate_OpenGL_extras()
-            generate_code("QtOpenGL")
+
+            qpy_inc_dir, qpy_lib_dir, qpy_lib = self._qpy_directories("QtOpenGL", "qpyopengl")
+
+            if opts.bigqt:
+                cons_xtra_incdirs.append(qpy_inc_dir)
+                cons_xtra_libdirs.append(qpy_lib_dir)
+                cons_xtra_libs.append(qpy_lib)
+
+                generate_code("QtOpenGL")
+            else:
+                generate_code("QtOpenGL", extra_include_dirs=[qpy_inc_dir],
+                        extra_lib_dirs=[qpy_lib_dir], extra_libs=[qpy_lib])
 
         if "QtScript" in pyqt_modules:
             generate_code("QtScript")
         else:
             qpy_lib_dir = qpy_dir
 
+            if sys.platform == 'darwin' and opts.debug:
+                lib_name += '_debug'
+
         return os.path.join(src_dir, qpy_dir), os.path.abspath(qpy_lib_dir), lib_name
 
     def _static_plugins(self, mname):
         if "QtGui" in pyqt_modules:
             qpylibs["QtGui"] = "qpygui.pro"
 
+        if "QtDBus" in pyqt_modules:
+            qpylibs["QtDBus"] = "qpydbus.pro"
+
         if "QtDeclarative" in pyqt_modules:
             qpylibs["QtDeclarative"] = "qpydeclarative.pro"
 
         if "QtDesigner" in pyqt_modules:
             qpylibs["QtDesigner"] = "qpydesigner.pro"
 
+        if "QtOpenGL" in pyqt_modules:
+            qpylibs["QtOpenGL"] = "qpyopengl.pro"
+
         # Run qmake to generate the Makefiles.
         qmake_args = fix_qmake_args()
         cwd = os.getcwd()
                 f.write("QMAKE_MAC_SDK = %s\n" % cfg.universal)
 
             inc_path = [cfg.py_inc_dir]
-            if qpy in ("QtCore", "QtDeclarative"):
+            if qpy in ("QtCore", "QtDBus", "QtDeclarative", "QtOpenGL"):
                 if cfg.sip_inc_dir != cfg.py_inc_dir:
                     inc_path.insert(0, cfg.sip_inc_dir)
 
                 qt=["QtCore"],
                 debug=opts.debug,
                 universal=cfg.universal,
-                arch=cfg.arch
+                arch=cfg.arch,
+                deployment_target=cfg.deployment_target
             )
 
             add_makefile_extras(makefile, dbusincdirs, dbuslibdirs, dbuslibs)
             makefile.generate()
             tool.append("dbus")
 
-        # Only include ElementTree for older versions of Python.
-        if cfg.py_version < 0x020500:
-            sipconfig.inform("Creating elementtree Makefile...")
-
-            makefile = cross_sipconfig.PythonModuleMakefile(
-                configuration=cfg,
-                dstdir=os.path.join(pyqt_modroot, "elementtree"),
-                dir="elementtree"
-            )
-
-            makefile.generate()
-            tool.append("elementtree")
-
-        # Create the pyuic4 wrapper.  Use the GUI version on MacOS (so that
-        # previews work properly and normal console use will work anyway), but
-        # not on Windows (so that normal console use will work).
-        sipconfig.inform("Creating pyuic4 wrapper...")
-
-        if sys.platform == 'darwin':
-            gui = True
-            use_arch = opts.use_arch
-        else:
-            gui = False
-            use_arch = ''
+        # The pyuic directory may not exist if we are building away from the
+        # source directory.
+        try:
+            os.mkdir("pyuic")
+        except OSError:
+            pass
 
         uicdir=os.path.join(pyqt_modroot, "uic")
         wrapper = cross_sipconfig.create_wrapper(os.path.join(uicdir, "pyuic.py"), os.path.join("pyuic", "pyuic4"), (sys.platform == "darwin"))
                 debug=opts.debug,
                 warnings=1,
                 universal=cfg.universal,
-                arch=cfg.arch
+                arch=cfg.arch,
+                deployment_target=cfg.deployment_target
             )
 
             makefile.extra_include_dirs.append(os.path.join(src_dir, "pylupdate"))
             py_minor = (cfg.py_version >> 8) & 0x0ff
 
             if sys.platform == 'win32':
+                # Use abiflags in case it is supported in a future version.
                 lib_dir_flag = quote("-L%s" % cfg.py_lib_dir)
-                link = "%s -lpython%d%d" % (lib_dir_flag, py_major, py_minor)
-                pysh_lib = "python%d%d.dll" % (py_major, py_minor)
+                link = "%s -lpython%d%d%s" % (lib_dir_flag, py_major, py_minor, abi)
+                pysh_lib = "python%d%d%s.dll" % (py_major, py_minor, abi)
             else:
                 # Use distutils to get the additional configuration.
                 from distutils.sysconfig import get_config_vars
                     # We need to work out how to specify the right framework
                     # version.
                     link = "-framework Python"
-                elif ("--enable-shared" in ducfg.get("CONFIG_ARGS", "") and
-                      glob.glob("%s/lib/libpython%d.%d*" % (ducfg["exec_prefix"], py_major, py_minor))):
-                    lib_dir_flag = quote("-L%s/lib" % ducfg["exec_prefix"])
-                    link = "%s -lpython%d.%d" % (lib_dir_flag, py_major, py_minor)
+                elif "--enable-shared" in ducfg.get("CONFIG_ARGS", ""):
+                    if glob.glob("%s/lib/libpython%d.%d*" % (ducfg["exec_prefix"], py_major, py_minor)):
+                        lib_dir_flag = quote("-L%s/lib" % ducfg["exec_prefix"])
+                    elif glob.glob("%s/libpython%d.%d*" % (ducfg["LIBDIR"], py_major, py_minor)):
+                        lib_dir_flag = quote("-L%s" % ducfg["LIBDIR"])
+                    else:
+                        sipconfig.inform("Qt Designer plugin disabled because Python library couldn't be found")
+                        opts.designer_plugin = False
+
+                    link = "%s -lpython%d.%d%s" % (lib_dir_flag, py_major, py_minor, abi)
                 else:
                     sipconfig.inform("Qt Designer plugin disabled because Python library is static")
                     opts.designer_plugin = False
 
-                pysh_lib = ducfg["LDLIBRARY"]
+                pysh_lib = ducfg.get("LDLIBRARY", "")
 
             if opts.designer_plugin:
                 sipconfig.inform("Creating Qt Designer plugin Makefile...")
                 if sipcfg.universal:
                     fout.write("QMAKE_MAC_SDK = %s\n" % cfg.universal)
 
+                if sipcfg.deployment_target:
+                    fout.write("QMAKE_MACOSX_DEPLOYMENT_TARGET = %s\n" % cfg.deployment_target)
+
                 if src_dir != os.path.curdir:
                     fout.write("VPATH = %s\n" % os.path.join(src_dir, "designer"))
 
     cross_sipconfig.create_config_module(module, template, content, macros)
 
 
-def run_command(cmd):
+def run_command(cmd, envvars=None):
     """Run a command and display the output if verbose mode is enabled.
 
     cmd is the command to run.
     if opts.verbose:
         sys.stdout.write(cmd + "\n")
 
-    fout = get_command_stdout(cmd, and_stderr=True)
+    fout = get_command_stdout(cmd, and_stderr=True, envvars=envvars)
 
     # Read stdout and stderr until there is no more output.
     lout = fout.readline()
 
     cfg = cross_sipcfg or sipcfg
     makefile = cross_sipconfig.ProgramMakefile(cfg, console=1, qt=qt, warnings=0,
-            opengl=opengl, debug=opts.debug, arch=cfg.arch)
+            opengl=opengl, debug=opts.debug, arch=cfg.arch,
+            deployment_target=cfg.deployment_target)
 
     add_makefile_extras(makefile, extra_include_dirs, extra_lib_dirs, extra_libs)
     
 
     exe, build = makefile.build_command(name)
 
+    if cfg.deployment_target:
+        envvars = {'MACOSX_DEPLOYMENT_TARGET': '%s' % cfg.deployment_target}
+    else:
+        envvars = None
+
     # Make sure the executable file doesn't exist.
     remove_file(exe)
-    run_command(build)
+    run_command(build, envvars=envvars)
 
     if not os.access(exe, os.X_OK):
         return None
                              "correct directory." % opts.vendincdir)
 
 
-def get_command_stdout(cmd, and_stderr=False):
+def get_command_stdout(cmd, and_stderr=False, envvars=None):
     """Return stdout (and optionally stderr) from the given command.
     """
+    if envvars is not None:
+        env = os.environ.copy()
+        env.update(envvars)
+    else:
+        env = None
+
     try:
         import subprocess
     except ImportError:
         stderr = subprocess.PIPE
 
     p = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE,
-            stdout=subprocess.PIPE, stderr=stderr)
+            stdout=subprocess.PIPE, stderr=stderr, env=env)
 
     return p.stdout
 
         sipconfig.inform("DBus v1 does not seem to be installed.")
         return
 
-    # Using str() means it will work with both Python v2 and v3.
-    for f in str(iflags).split():
+    if sys.hexversion >= 0x03000000:
+        iflags = iflags.decode()
+
+    for f in iflags.split():
         if f.startswith("-I"):
             dbusincdirs.append(f[2:])
         elif f.startswith("-L"):
             qt_libs = []
             needed_qt_libs(mname, qt_libs)
 
-    # Build the SIP command line.  Keyword argument support is enabled.
-    argv = ['"' + sipcfg.sip_bin + '"', '-k']
+    # Build the SIP command line.
+    argv = ['"' + sipcfg.sip_bin + '"', '-w']
+
+    if opts.no_timestamp:
+        argv.append("-T")
 
     if not opts.no_docstrings:
         argv.append("-o");
         argv.append("-a")
         argv.append(mname + ".api")
 
+    # Pass the absolute pathname so that #line files are absolute.
     argv.append("-c")
-    argv.append(mname)
+    argv.append(os.path.abspath(mname))
 
     buildfile = os.path.join(mname, mname + ".sbf")
     argv.append("-b")
         debug=opts.debug,
         universal=cfg.universal,
         arch=cfg.arch,
-        prot_is_public=opts.prot_is_public
+        prot_is_public=opts.prot_is_public,
+        deployment_target=cfg.deployment_target
     )
 
     add_makefile_extras(makefile, extra_include_dirs, extra_lib_dirs, extra_libs)
     makefile.generate()
 
 
+def fix_license(name):
+    """ Fix the license file, if there is one, so that it conforms to the SIP
+    v5 syntax.
+    """
+
+    try:
+        f = open(name, "r")
+    except IOError:
+        sipconfig.error("Failed to open license file %s." % name)
+
+    f5 = open(name + "5", "w")
+
+    for line in f:
+        if line.startswith("%License"):
+            anno_start = line.find("/")
+            anno_end = line.rfind("/")
+
+            if anno_start < 0 or anno_end < 0 or anno_start == anno_end:
+                sipconfig.error("%s has missing annotations." % name)
+
+            annos = line[anno_start + 1:anno_end].split(", ")
+            annos5 = [anno[0].lower() + anno[1:] for anno in annos]
+
+            f5.write("%License(")
+            f5.write(", ".join(annos5))
+            f5.write(")\n")
+        else:
+            f5.write(line)
+
+    f5.close()
+    f.close()
+
+
 def check_license():
     """Handle the validation of the PyQt license.
     """
     if ltype is None:
         ltype = "GPL"
         lname = "GNU General Public License"
-        lfile = None
+        lfile = "pyqt-gpl.sip"
 
     sipconfig.inform("This is the %s version of PyQt %s (licensed under the %s) for Python %s on %s." % (ltype, pyqt_version_str, lname, sys.version.split()[0], sys.platform))
 
                 if resp == "l":
                     os.system("more LICENSE")
 
-    # If there should be a license file then check it is where it should be.
-    if lfile:
-        if os.access(os.path.join(src_dir, "sip", lfile), os.F_OK):
-            sipconfig.inform("Found the license file %s." % lfile)
-        else:
-            sipconfig.error("Please copy the license file %s to the sip directory." % lfile)
+    # Check that the license file exists and fix its syntax.
+    lfile_path = os.path.join(src_dir, "sip", lfile)
+
+    if os.access(lfile_path, os.F_OK):
+        sipconfig.inform("Found the license file %s." % lfile)
+        fix_license(lfile_path)
+    else:
+        sipconfig.error("Please copy the license file %s to the sip directory." % lfile)
 
 
 def get_build_macros(overrides):
     if qt_version < 0x040100:
         sipconfig.error("PyQt v4 requires Qt v4.1.0 or later.")
 
+    # Starting with v4.7, Qt (when built with MinGW) assumes that stack frames
+    # are 16 byte aligned because it uses SSE.  However the Python Windows
+    # installers are built with 4 byte aligned stack frames.  We therefore need
+    # to tweak the g++ flags to deal with it.
+    if sipcfg.platform == 'win32-g++' and qt_version >= 0x040700:
+        macros['CFLAGS'] += ' -mstackrealign'
+        macros['CXXFLAGS'] += ' -mstackrealign'
+
     # Work out how Qt was built on MacOS.
     if sys.platform == "darwin":
         if os.access(os.path.join(qt_libdir, "QtCore.framework"), os.F_OK):
     # Get the Makefile generator.
     generator = macros["MAKEFILE_GENERATOR"]
 
+    if cross_sipconfig:
+        macros["CXXFLAGS"] += ' -fPIC -fpermissive '
+        macros["LFLAGS_PLUGIN"] += " -Wl,-rpath="+qt_libdir+" "
+
     # We haven't yet factored out sipconfig's knowledge of how to build Qt
     # binaries and it is expecting to find these in the configuration when it
     # generates the Makefiles.
     qmake_args = fix_qmake_args("-o " + make_file)
 
     if sys.platform == 'win32':
-        exe_file = os.path.join("release", app + ".exe")
-        make_target = " release"
+        if opts.debug:
+            exe_file = os.path.join("debug", app + ".exe")
+            make_target = " debug"
+        else:
+            exe_file = os.path.join("release", app + ".exe")
+            make_target = " release"
     elif sys.platform == "darwin":
         exe_file = os.path.join(app + ".app", "Contents", "MacOS", app)
     else:
     ### have to keep the list of checks for Qt features up to date.
 
     f.write(
-"""#include <QFile>
+"""#include <QCoreApplication>
+#include <QFile>
 #include <QLibraryInfo>
 #include <QTextStream>
 
-int main(int, char **)
+int main(int argc, char **argv)
 {
+    QCoreApplication app(argc, argv);
     QFile outf("%s");
 
     if (!outf.open(QIODevice::WriteOnly|QIODevice::Truncate|QIODevice::Text))
     out << "PyQt_Accessibility\\n";
 #endif
 
-#if defined(QT_NO_BIGCODECS)
-    out << "PyQt_BigCodecs\\n";
+#if defined(QT_NO_SESSIONMANAGER)
+    out << "PyQt_SessionManager\\n";
 #endif
 
-#if defined(QT_NO_BUTTONGROUP)
-    out << "PyQt_ButtonGroup\\n";
+#if defined(QT_NO_STATUSTIP)
+    out << "PyQt_StatusTip\\n";
 #endif
 
-#if defined(QT_NO_CLIPBOARD)
-    out << "PyQt_Clipboard\\n";
+#if defined(QT_NO_TOOLTIP)
+    out << "PyQt_ToolTip\\n";
 #endif
 
-#if defined(QT_NO_CODECS)
-    out << "PyQt_Codecs\\n";
-#endif
-
-#if defined(QT_NO_COLORDIALOG)
-    out << "PyQt_ColorDialog\\n";
-#endif
-
-#if defined(QT_NO_COLORNAMES)
-    out << "PyQt_ColorNames\\n";
-#endif
-
-#if defined(QT_NO_CONTEXTMENU)
-    out << "PyQt_ContextMenu\\n";
-#endif
-
-#if defined(QT_NO_CURSOR)
-    out << "PyQt_Cursor\\n";
-#endif
-
-#if defined(QT_NO_DIAL)
-    out << "PyQt_Dial\\n";
-#endif
-
-#if defined(QT_NO_DIRECTPAINTER)
-    out << "PyQt_DirectPainter\\n";
-#endif
-
-#if defined(QT_NO_DIRMODEL)
-    out << "PyQt_DirModel\\n";
-#endif
-
-#if defined(QT_NO_DOCKWIDGET)
-    out << "PyQt_DockWidget\\n";
-#endif
-
-#if defined(QT_NO_DOM)
-    out << "PyQt_DOMClasses\\n";
-#endif
-
-#if defined(QT_NO_DRAGANDDROP)
-    out << "PyQt_DragAndDrop\\n";
-#endif
-
-#if defined(QT_NO_ERRORMESSAGE)
-    out << "PyQt_ErrorMessage\\n";
-#endif
-
-#if defined(QT_NO_FILEDIALOG)
-    out << "PyQt_FileDialog\\n";
-#endif
-
-#if defined(QT_NO_FONTDIALOG)
-    out << "PyQt_FontDialog\\n";
-#endif
-
-#if defined(QT_NO_IMAGEFORMATPLUGIN)
-    out << "PyQt_ImageFormatPlugin\\n";
-#endif
-
-#if defined(QT_NO_IMAGEFORMAT_PPM)
-    out << "PyQt_ImageFormat_PPM\\n";
-#endif
-
-#if defined(QT_NO_IMAGE_HEURISTIC_MASK)
-    out << "PyQt_Image_Heuristic_Mask\\n";
-#endif
-
-#if defined(QT_NO_INPUTDIALOG)
-    out << "PyQt_InputDialog\\n";
-#endif
-
-#if defined(QT_NO_IMAGE_TEXT)
-    out << "PyQt_Image_Text\\n";
-#endif
-
-#if defined(QT_NO_ITEMVIEWS)
-    out << "PyQt_ItemViews\\n";
-#endif
-
-#if defined(QT_NO_LCDNUMBER)
-    out << "PyQt_LCDNumber\\n";
-#endif
-
-#if defined(QT_NO_LINEEDITMENU)
-    out << "PyQt_LineEditMenu\\n";
-#endif
-
-#if defined(QT_NO_LISTVIEW)
-    out << "PyQt_ListView\\n";
-#endif
-
-#if defined(QT_NO_LISTWIDGET)
-    out << "PyQt_ListWidget\\n";
-#endif
-
-#if defined(QT_NO_MAINWINDOW)
-    out << "PyQt_MainWindow\\n";
-#endif
-
-#if defined(QT_NO_MENU)
-    out << "PyQt_Menu\\n";
-#endif
-
-#if defined(QT_NO_MENUBAR)
-    out << "PyQt_MenuBar\\n";
-#endif
-
-#if defined(QT_NO_MESSAGEBOX)
-    out << "PyQt_MessageBox\\n";
-#endif
-
-#if defined(QT_NO_NETWORKPROXY)
-    out << "PyQt_NetworkProxy\\n";
+#if defined(QT_NO_WHATSTHIS)
+    out << "PyQt_WhatsThis\\n";
 #endif
 
 #if defined(QT_NO_OPENSSL)
     out << "PyQt_SystemTrayIcon\\n";
 #endif
 
-#if defined(QT_NO_TABBAR)
-    out << "PyQt_TabBar\\n";
+#if defined(QT_NO_PRINTDIALOG)
+    out << "PyQt_PrintDialog\\n";
 #endif
 
-#if defined(QT_NO_TABDIALOG)
-    out << "PyQt_TabDialog\\n";
+#if defined(QT_NO_PRINTER)
+    out << "PyQt_Printer\\n";
 #endif
 
-#if defined(QT_NO_TABWIDGET)
-    out << "PyQt_TabWidget\\n";
+#if defined(QT_NO_PRINTPREVIEWDIALOG)
+    out << "PyQt_PrintPreviewDialog\\n";
 #endif
 
-#if defined(QT_NO_TABLEVIEW)
-    out << "PyQt_TableView\\n";
-#endif
-
-#if defined(QT_NO_TEXTEDITMENU)
-    out << "PyQt_TextEditMenu\\n";
-#endif
-
-#if defined(QT_NO_THREAD)
-    out << "PyQt_Thread\\n";
-#endif
-
-#if defined(QT_NO_TOOLBAR)
-    out << "PyQt_ToolBar\\n";
-#endif
-
-#if defined(QT_NO_TOOLBOX)
-    out << "PyQt_ToolBox\\n";
-#endif
-
-#if defined(QT_NO_TOOLBUTTON)
-    out << "PyQt_ToolButton\\n";
-#endif
-
-#if defined(QT_NO_TOOLTIP)
-    out << "PyQt_ToolTip\\n";
-#endif
-
-#if defined(QT_NO_TRANSLATION)
-    out << "PyQt_Translator\\n";
-#endif
-
-#if defined(QT_NO_WHATSTHIS)
-    out << "PyQt_WhatsThis\\n";
-#endif
-
-#if defined(QT_NO_WHEELEVENT)
-    out << "PyQt_WheelEvent\\n";
-#endif
-
-#if defined(QT_NO_WORKSPACE)
-    out << "PyQt_Workspace\\n";
+#if defined(QT_NO_PRINTPREVIEWWIDGET)
+    out << "PyQt_PrintPreviewWidget\\n";
 #endif
 
 #if !defined(QT3_SUPPORT) || QT_VERSION >= 0x040200
     out << "PyQt_NoOpenGLES\\n";
 #endif
 
-    if (sizeof (qreal) != sizeof (double))
+#if defined(QT_NO_FPU) || defined(QT_ARCH_ARM) || defined(QT_ARCH_WINDOWSCE)
         out << "PyQt_qreal_double\\n";
+#endif
 
     return 0;
 }

PyQt4-Qt-Embedded-Linux-patches/patch_files.py

 
 import os, glob, shutil, sys
 
-
 def find_files(pattern, path):
 
     files = glob.glob(os.path.join(path, pattern))
     
     return files
 
+def create_feature_map(paths):
+
+    features = {}
+    in_features = []
+    in_structures = []
+    declared_features = set()
+    
+    for path in paths:
+        print path
+        for line in open(path).readlines():
+            line = line.strip()
+            if line.startswith("%If ("):
+                feature = line[5:line.find(")", 5)]
+                in_features.append(feature)
+                in_structures.append(feature)
+            elif line.startswith("%End"):
+                if in_features and in_structures[-1] == in_features[-1]:
+                    in_features.pop()
+                in_structures.pop()
+            elif line.startswith("%Include"):
+                name = line[9:-4].strip()
+                if in_features:
+                    features[name] = set(in_features)
+            elif line.startswith("%Feature"):
+                declared_features.add(line[9:].strip())
+            elif line.startswith("%"):
+                in_structures.append(line[1:])
+    
+    for name, in_features in features.items():
+        features[name] = in_features.intersection(declared_features)
+
+    return features
+
+def change_graph(path, features):
+
+    lines = open(path).readlines()
+    new_lines = []
+    
+    for line in lines:
+    
+        at = line.find("{sipName_")
+        if at != -1:
+        
+            # Look up the features corresponding to the class name.
+            name = line[at+9:line.find(",", at+9)]
+            if name.lower() in features:
+            
+                # Look at the previous line.
+                if not new_lines or not new_lines[-1].strip().startswith("#if "):
+                    # Create a check for the class.
+                    new_lines.append("    #if ")
+                    existing = False
+                else:
+                    new_lines[-1] = new_lines[-1].rstrip() + " && "
+                    existing = True
+
+                # Append conditions to the check.
+                new_lines[-1] += " && ".join(map(lambda feature: "defined(SIP_FEATURE_" + feature + ")", features[name.lower()]))
+                new_lines[-1] += "\n"
+
+                # Add the line to the output.
+                new_lines.append(line)
+
+                if not existing:
+                    # For new checks, add a fallback structure.
+                    new_lines.append("    #else\n")
+                    
+                    start = line.find("{") + 1
+                    end = line.find("}")
+                    values = line[start:end].split(",")
+                    new_lines.append(line[:start] + "0, 0," + ", ".join(values[-2:]) + line[end:])
+                    new_lines.append("    #endif\n")
+        else:
+            new_lines.append(line)
+    
+    open(path, "w").write("".join(new_lines))
+
 
 if __name__ == "__main__":
 
             sys.stderr.write("Failed to patch file: %s\n" % target)
             sys.exit(1)
     
+    # Change the graph data structures of existing files to handle features.
+    feature_map = create_feature_map(find_files("Qt*mod"+os.extsep+"sip", target_dir))
+
+    for path in target_files:
+        change_graph(path, feature_map)
+
     new_files = find_files("*"+os.extsep+"sip", patches_dir)
     
     target_files = map(lambda path:

PyQt4-Qt-Embedded-Linux-patches/qpy/QtCore/qpycore_api.h.diff

---- qpy/QtCore/qpycore_api.h.old	2009-10-01 01:45:46.000000000 +0200
-+++ qpy/QtCore/qpycore_api.h	2009-10-01 01:54:17.000000000 +0200
-@@ -33,6 +33,7 @@
+--- qpy/QtCore/qpycore_api.h.old	2012-10-04 17:51:55.172239140 +0200
++++ qpy/QtCore/qpycore_api.h	2012-10-04 17:51:55.180239140 +0200
+@@ -28,6 +28,7 @@
  #define _QPYCORE_API_H
  
  
  #include <QCoreApplication>
  #include <QString>
  #include <QVariant>
-@@ -49,7 +50,9 @@
- 
+@@ -47,7 +48,9 @@
+ PyObject *qpycore_pyqtsignature(PyObject *args, PyObject *kwds);
  
  // Support for pyqtConfigure().
 +#ifndef QT_NO_PROPERTIES
  int qpycore_pyqtconfigure(PyObject *self, QObject *qobj, PyObject *kwds);
 +#endif
  
- 
  // Support for converting between PyObject and QString.
+ PyObject *qpycore_PyObject_FromQString(const QString &qstr);

PyQt4-Qt-Embedded-Linux-patches/qpy/QtCore/qpycore_init.cpp.diff

---- qpy/QtCore/qpycore_init.cpp.old	2009-10-01 01:45:46.000000000 +0200
-+++ qpy/QtCore/qpycore_init.cpp	2009-10-01 01:54:27.000000000 +0200
-@@ -30,6 +30,7 @@
+--- qpy/QtCore/qpycore_init.cpp.old	2012-10-04 17:51:55.192239140 +0200
++++ qpy/QtCore/qpycore_init.cpp	2012-10-04 17:51:55.200239140 +0200
+@@ -25,6 +25,7 @@
  
  #include <Python.h>
  
 +#include <qconfig.h>
+ #include "qpycore_chimera.h"
  #include "qpycore_qobject_helpers.h"
  #include "qpycore_shared.h"
- #include "qpycore_sip.h"
-@@ -57,7 +58,9 @@
+@@ -54,7 +55,9 @@
      sipExportSymbol("qpycore_qobject_receivers",
              (void *)qpycore_qobject_receivers);
  

PyQt4-Qt-Embedded-Linux-patches/qpy/QtCore/qpycore_pyqtconfigure.cpp.diff

---- qpy/QtCore/qpycore_pyqtconfigure.cpp.old	2009-10-01 01:45:46.000000000 +0200
-+++ qpy/QtCore/qpycore_pyqtconfigure.cpp	2009-10-01 01:54:10.000000000 +0200
-@@ -28,6 +28,8 @@
+--- qpy/QtCore/qpycore_pyqtconfigure.cpp.old	2012-10-04 17:51:55.184239140 +0200
++++ qpy/QtCore/qpycore_pyqtconfigure.cpp	2012-10-04 17:51:55.188239140 +0200
+@@ -23,6 +23,8 @@
  // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  
  
  #include <Python.h>
  
  #include <QByteArray>
-@@ -140,3 +142,4 @@
+@@ -167,3 +169,4 @@
  
      return 0;
  }

PyQt4-Qt-Embedded-Linux-patches/qpy/QtCore/qpycore_qstring.cpp.diff

---- qpy/QtCore/qpycore_qstring.cpp.old	2009-10-01 01:45:46.000000000 +0200
-+++ qpy/QtCore/qpycore_qstring.cpp	2009-10-01 01:54:23.000000000 +0200
-@@ -31,8 +31,11 @@
+--- qpy/QtCore/qpycore_qstring.cpp.old	2012-10-04 17:51:55.204239140 +0200
++++ qpy/QtCore/qpycore_qstring.cpp	2012-10-04 17:51:55.244239140 +0200
+@@ -26,8 +26,11 @@
  #include <Python.h>
  #include <string.h>
  
  #include <QVector>
  
  #include "qpycore_sip.h"
-@@ -121,6 +124,7 @@
+@@ -116,6 +119,7 @@
          }
          else
          {
              QTextCodec *codec = QTextCodec::codecForTr();
  
              if (codec)
-@@ -140,6 +144,9 @@
+@@ -135,6 +139,9 @@
              {
                  obj = PyUnicode_AsLatin1String(obj);
              }

PyQt4-Qt-Embedded-Linux-patches/sip/QtCore/QtCoremod.sip.diff

---- sip/QtCore/QtCoremod.sip.old	2011-11-12 14:05:16.000000000 +0100
-+++ sip/QtCore/QtCoremod.sip	2011-11-12 14:14:23.000000000 +0100
-@@ -29,17 +29,152 @@
+--- sip/QtCore/QtCoremod.sip.old	2012-10-05 12:14:35.090890538 +0200
++++ sip/QtCore/QtCoremod.sip	2012-10-05 13:15:40.858872761 +0200
+@@ -29,17 +29,155 @@
  
- %Timeline {Qt_4_1_1 Qt_4_1_2 Qt_4_1_3 Qt_4_2_0 Qt_4_2_2 Qt_4_2_3 Qt_4_3_0 Qt_4_3_1 Qt_4_3_2 Qt_4_3_3 Qt_4_3_4 Qt_4_4_0 Qt_4_4_1 Qt_4_4_2 Qt_4_5_0 Qt_4_5_1 Qt_4_5_2 Qt_4_5_3 Qt_4_6_0 Qt_4_6_1 Qt_4_6_2 Qt_4_6_3 Qt_4_7_0 Qt_4_7_1 Qt_4_7_2 Qt_4_7_3 Qt_4_7_4}
+ %Timeline {Qt_4_1_1 Qt_4_1_2 Qt_4_1_3 Qt_4_2_0 Qt_4_2_2 Qt_4_2_3 Qt_4_3_0 Qt_4_3_1 Qt_4_3_2 Qt_4_3_3 Qt_4_3_4 Qt_4_4_0 Qt_4_4_1 Qt_4_4_2 Qt_4_5_0 Qt_4_5_1 Qt_4_5_2 Qt_4_5_3 Qt_4_6_0 Qt_4_6_1 Qt_4_6_2 Qt_4_6_3 Qt_4_7_0 Qt_4_7_1 Qt_4_7_2 Qt_4_7_3 Qt_4_7_4 Qt_4_8_0}
  
 -%Platforms {WS_X11 WS_WIN WS_MACX}
 +%Platforms {WS_X11 WS_WIN WS_MACX WS_QWS}
 +%Feature PyQt_Action
 +%Feature PyQt_Animation
 +%Feature PyQt_ButtonGroup
++%Feature PyQt_BearerManagement
 +%Feature PyQt_CalendarWidget
 +%Feature PyQt_Clipboard
 +%Feature PyQt_ColorDialog
 +%Feature PyQt_HostInfo
 +%Feature PyQt_HTTP
 +%Feature PyQt_Icon
++%Feature PyQt_IdentityProxyModel
 +%Feature PyQt_IM
 +%Feature PyQt_ImageFormatPlugin
 +%Feature PyQt_ImageFormat_BMP
 +%Feature PyQt_ProxyModel
 +%Feature PyQt_QWS_Cursor
 +%Feature PyQt_QWS_Manager
++%Feature PyQt_RawFont
 +%Feature PyQt_RubberBand
 +%Feature PyQt_ScrollArea
 +%Feature PyQt_ScrollBar
  %Feature PyQt_qreal_double
  %Feature Py_v3
  %Feature PyQt_PrintDialog
-@@ -130,13 +265,19 @@
+@@ -130,13 +268,19 @@
  
  %Include qglobal.sip
  %Include qnamespace.sip
  %Include qbasictimer.sip
  %Include qbitarray.sip
  %Include qbuffer.sip
-@@ -146,78 +287,132 @@
+@@ -146,78 +290,132 @@
  %Include qcoreapplication.sip
  %Include qcoreevent.sip
  %Include qcryptographichash.sip

PyQt4-Qt-Embedded-Linux-patches/sip/QtCore/qabstracteventdispatcher.sip.diff

---- sip/QtCore/qabstracteventdispatcher.sip.old	2010-09-07 01:47:48.000000000 +0200
-+++ sip/QtCore/qabstracteventdispatcher.sip	2010-09-07 01:48:34.000000000 +0200
-@@ -41,7 +41,9 @@
+--- sip/QtCore/qabstracteventdispatcher.sip.old	2012-10-04 17:51:54.972239141 +0200
++++ sip/QtCore/qabstracteventdispatcher.sip	2012-10-04 17:51:54.976239141 +0200
+@@ -36,7 +36,9 @@
  public:
      explicit QAbstractEventDispatcher(QObject *parent /TransferThis/ = 0);
      virtual ~QAbstractEventDispatcher();

PyQt4-Qt-Embedded-Linux-patches/sip/QtCore/qabstractitemmodel.sip.diff

---- sip/QtCore/qabstractitemmodel.sip.old	2010-09-11 00:11:48.000000000 +0200
-+++ sip/QtCore/qabstractitemmodel.sip	2010-09-11 00:20:52.000000000 +0200
+--- sip/QtCore/qabstractitemmodel.sip.old	2012-10-04 17:51:55.080239142 +0200
++++ sip/QtCore/qabstractitemmodel.sip	2012-10-04 17:51:55.084239142 +0200
 @@ -183,8 +183,10 @@
-     virtual void revert();
+ %End
  
  protected:
 +%If (PyQt_DataStream)

PyQt4-Qt-Embedded-Linux-patches/sip/QtCore/qabstracttransition.sip.diff

---- sip/QtCore/qabstracttransition.sip.old	2010-09-12 00:59:43.000000000 +0200
-+++ sip/QtCore/qabstracttransition.sip	2010-09-12 00:52:29.000000000 +0200
-@@ -47,9 +47,11 @@
+--- sip/QtCore/qabstracttransition.sip.old	2012-10-04 17:51:54.856239143 +0200
++++ sip/QtCore/qabstracttransition.sip	2012-10-04 17:51:54.860239143 +0200
+@@ -42,9 +42,11 @@
      QList<QAbstractState*> targetStates() const;
      void setTargetStates(const QList<QAbstractState*> &targets /KeepReference/);
      QStateMachine *machine() const;

PyQt4-Qt-Embedded-Linux-patches/sip/QtCore/qbitarray.sip.diff

---- sip/QtCore/qbitarray.sip.old	2009-06-14 22:29:33.000000000 +0200
-+++ sip/QtCore/qbitarray.sip	2009-06-14 22:29:33.000000000 +0200
-@@ -101,8 +101,10 @@
+--- sip/QtCore/qbitarray.sip.old	2012-10-04 17:51:54.816239142 +0200
++++ sip/QtCore/qbitarray.sip	2012-10-04 17:51:54.820239142 +0200
+@@ -93,8 +93,10 @@
  QBitArray operator&(const QBitArray &, const QBitArray &);
  QBitArray operator|(const QBitArray &, const QBitArray &);
  QBitArray operator^(const QBitArray &, const QBitArray &);

PyQt4-Qt-Embedded-Linux-patches/sip/QtCore/qbytearray.sip.diff

---- sip/QtCore/qbytearray.sip.old	2010-09-07 02:05:18.000000000 +0200
-+++ sip/QtCore/qbytearray.sip	2010-09-07 02:05:36.000000000 +0200
-@@ -394,8 +394,10 @@
+--- sip/QtCore/qbytearray.sip.old	2012-10-04 17:51:54.844239142 +0200
++++ sip/QtCore/qbytearray.sip	2012-10-04 17:51:54.852239143 +0200
+@@ -411,8 +411,10 @@
  bool operator>(const QByteArray &a1, const QByteArray &a2);
  bool operator>=(const QByteArray &a1, const QByteArray &a2);
  const QByteArray operator+(const QByteArray &a1, const QByteArray &a2);

PyQt4-Qt-Embedded-Linux-patches/sip/QtCore/qchar.sip.diff

---- sip/QtCore/qchar.sip.old	2010-09-07 01:53:31.000000000 +0200
-+++ sip/QtCore/qchar.sip	2010-09-07 01:53:55.000000000 +0200
-@@ -407,5 +407,7 @@
+--- sip/QtCore/qchar.sip.old	2012-10-04 17:51:55.152239140 +0200
++++ sip/QtCore/qchar.sip	2012-10-04 17:51:55.160239140 +0200
+@@ -414,5 +414,7 @@
  bool operator>=(QChar c1, QChar c2);
  bool operator<(QChar c1, QChar c2);
  bool operator>(QChar c1, QChar c2);

PyQt4-Qt-Embedded-Linux-patches/sip/QtCore/qcoreapplication.sip.diff

---- sip/QtCore/qcoreapplication.sip.old	2009-06-14 22:29:33.000000000 +0200
-+++ sip/QtCore/qcoreapplication.sip	2009-06-14 22:29:33.000000000 +0200
-@@ -176,12 +176,16 @@
+--- sip/QtCore/qcoreapplication.sip.old	2012-10-04 17:51:54.908239143 +0200
++++ sip/QtCore/qcoreapplication.sip	2012-10-04 17:51:54.916239142 +0200
+@@ -165,12 +165,16 @@
      static bool closingDown();
      static QString applicationDirPath();
      static QString applicationFilePath();
  
      enum Encoding
      {
-@@ -346,18 +350,23 @@
+@@ -340,18 +344,23 @@
      }
  }
  %End
  %ModuleCode
  #include <QCoreApplication>
  #include <QThread>
-@@ -403,8 +412,11 @@
+@@ -397,8 +406,11 @@
      return 0;
  }
  %End

PyQt4-Qt-Embedded-Linux-patches/sip/QtCore/qcoreevent.sip.diff

---- sip/QtCore/qcoreevent.sip.old	2010-10-10 02:02:58.000000000 +0200
-+++ sip/QtCore/qcoreevent.sip	2010-10-10 02:15:56.000000000 +0200
-@@ -55,7 +55,7 @@
+--- sip/QtCore/qcoreevent.sip.old	2012-10-04 17:51:55.120239141 +0200
++++ sip/QtCore/qcoreevent.sip	2012-10-04 17:51:55.124239140 +0200
+@@ -50,7 +50,7 @@
              break;
      #endif
      
      case QEvent::StateMachineSignal:
              sipType = sipType_QStateMachine_SignalEvent;
              break;
-@@ -274,12 +274,14 @@
+@@ -269,12 +269,14 @@
  %If (Qt_4_6_0 -)
          WinIdChange,
  %End

PyQt4-Qt-Embedded-Linux-patches/sip/QtCore/qdatetime.sip.diff

---- sip/QtCore/qdatetime.sip.old	2010-10-05 00:18:32.000000000 +0200
-+++ sip/QtCore/qdatetime.sip	2010-10-05 00:20:05.000000000 +0200
-@@ -98,6 +98,7 @@
-                  sipCpp->month(), sipCpp->day());
+--- sip/QtCore/qdatetime.sip.old	2012-10-04 17:51:54.896239143 +0200
++++ sip/QtCore/qdatetime.sip	2012-10-04 17:51:54.904239143 +0200
+@@ -104,6 +104,7 @@
+         }
  %End
  
 +%If (PyQt_DateString)
      long __hash__() const;
  %MethodCode
          if (sipIsAPIEnabled("QDate", 2, 0))
-@@ -110,6 +111,7 @@
+@@ -116,6 +117,7 @@
              sipRes = _Py_HashPointer(sipSelf);
          }
  %End
  
  %If (Py_DateTime)
      SIP_PYOBJECT toPyDate() const /DocType="datetime.date"/;
-@@ -137,12 +139,16 @@
+@@ -143,12 +145,16 @@
      int daysInMonth() const;
      int daysInYear() const;
      int weekNumber(int *yearNumber = 0) const;
      bool setYMD(int y, int m, int d);
      QDate addDays(int days) const;
      QDate addMonths(int months) const;
-@@ -155,8 +161,10 @@
+@@ -161,8 +167,10 @@
      bool operator>(const QDate &other) const;
-     bool operator>=(const QDate &otherOB) const;
+     bool operator>=(const QDate &other) const;
      static QDate currentDate();
 +%If (PyQt_DateString)
      static QDate fromString(const QString &string, Qt::DateFormat format = Qt::TextDate);
      static bool isValid(int y, int m, int d);
      static bool isLeapYear(int year);
      static uint gregorianToJulian(int y, int m, int d);
-@@ -178,6 +186,7 @@
+@@ -184,6 +192,7 @@
      };
  
  %End
  %If (Qt_4_5_0 -)
      static QString shortMonthName(int month, QDate::MonthNameType type);
  %End
-@@ -190,6 +199,7 @@
+@@ -196,6 +205,7 @@
  %If (Qt_4_5_0 -)
      static QString longDayName(int weekday, QDate::MonthNameType type);
  %End
  };
  
  class QTime
-@@ -280,6 +290,7 @@
-         #endif
+@@ -297,6 +307,7 @@
+         }
  %End
  
 +%If (PyQt_DateString)
      long __hash__() const;
  %MethodCode
          if (sipIsAPIEnabled("QTime", 2, 0))
-@@ -292,6 +303,7 @@
+@@ -309,6 +320,7 @@
              sipRes = _Py_HashPointer(sipSelf);
          }
  %End
  
  %If (Py_DateTime)
      SIP_PYOBJECT toPyTime() const /DocType="datetime.time"/;
-@@ -315,8 +327,10 @@
+@@ -332,8 +344,10 @@
      int minute() const;
      int second() const;
      int msec() const;
      bool setHMS(int h, int m, int s, int msec = 0);
      QTime addSecs(int secs) const;
      int secsTo(const QTime &) const;
-@@ -329,8 +343,10 @@
+@@ -346,8 +360,10 @@
      bool operator>(const QTime &other) const;
      bool operator>=(const QTime &other) const;
      static QTime currentTime();
      static bool isValid(int h, int m, int s, int msec = 0);
      void start();
      int restart();
-@@ -465,6 +481,7 @@
-         #endif
+@@ -495,6 +511,7 @@
+         }
  %End
  
 +%If (PyQt_DateString)
      long __hash__() const;
  %MethodCode
          if (sipIsAPIEnabled("QDateTime", 2, 0))
-@@ -477,6 +494,7 @@
+@@ -507,6 +524,7 @@
              sipRes = _Py_HashPointer(sipSelf);
          }
  %End
  
  %If (Py_DateTime)
      SIP_PYOBJECT toPyDateTime() const /DocType="datetime.datetime"/;
-@@ -508,8 +526,10 @@
+@@ -538,8 +556,10 @@
      void setTime(const QTime &time);
      void setTimeSpec(Qt::TimeSpec spec);
      void setTime_t(uint secsSince1Jan1970UTC);
      QDateTime addDays(int days) const;
      QDateTime addMonths(int months) const;
      QDateTime addYears(int years) const;
-@@ -527,8 +547,10 @@
+@@ -557,8 +577,10 @@
      bool operator>(const QDateTime &other) const;
      bool operator>=(const QDateTime &other) const;
      static QDateTime currentDateTime();
  %If (Qt_4_2_0 -)
      static QDateTime fromTime_t(uint secsSince1Jan1970UTC);
  %End
-@@ -552,9 +574,11 @@
+@@ -582,9 +604,11 @@
  %End
  };
  

PyQt4-Qt-Embedded-Linux-patches/sip/QtCore/qline.sip.diff

---- sip/QtCore/qline.sip.old	2009-06-14 22:29:33.000000000 +0200
-+++ sip/QtCore/qline.sip	2009-06-14 22:29:33.000000000 +0200
+--- sip/QtCore/qline.sip.old	2012-10-04 17:51:55.044239141 +0200
++++ sip/QtCore/qline.sip	2012-10-04 17:51:55.048239141 +0200
 @@ -104,8 +104,10 @@
  %End
  };
  
  class QLineF
  {
-@@ -218,5 +220,7 @@
+@@ -229,5 +231,7 @@
  %End
  };
  

PyQt4-Qt-Embedded-Linux-patches/sip/QtCore/qlocale.sip.diff

---- sip/QtCore/qlocale.sip.old	2010-09-26 03:42:23.000000000 +0200
-+++ sip/QtCore/qlocale.sip	2010-09-26 04:15:58.000000000 +0200
-@@ -567,6 +567,7 @@
+--- sip/QtCore/qlocale.sip.old	2012-10-04 17:51:54.920239141 +0200
++++ sip/QtCore/qlocale.sip	2012-10-04 17:51:54.928239141 +0200
+@@ -715,6 +715,7 @@
  %If (Qt_4_4_0 -)
-     QString dateTimeFormat(QLocale::FormatType format = QLocale::LongFormat) const;
+     QString toString(const QDateTime &dateTime, const QString &format) const;
  %End
 +%If (PyQt_DateString)
  %If (Qt_4_4_0 -)
-     QDate toDate(const QString &, QLocale::FormatType format = QLocale::LongFormat) const;
+     QString toString(const QDateTime &dateTime, QLocale::FormatType format = QLocale::LongFormat) const;
  %End
-@@ -585,6 +586,7 @@
+@@ -745,6 +746,7 @@
  %If (Qt_4_4_0 -)
-     QDateTime toDateTime(const QString &, const QString &) const;
+     QDateTime toDateTime(const QString &string, const QString &format) const;
  %End
 +%End
      QChar decimalPoint() const;
      QChar groupSeparator() const;
      QChar percent() const;
-@@ -635,8 +637,10 @@
+@@ -893,8 +895,10 @@
  %End
  };
  
  QDataStream &operator>>(QDataStream &, QLocale & /Constrained/);
 +%End
  %If (Qt_4_2_0 -)
- QFlags<QLocale::NumberOption> operator|(QLocale::NumberOption, QFlags<QLocale::NumberOption>);
+ QFlags<QLocale::NumberOption> operator|(QLocale::NumberOption f1, QFlags<QLocale::NumberOption> f2);
  %End

PyQt4-Qt-Embedded-Linux-patches/sip/QtCore/qnamespace.sip.diff

---- sip/QtCore/qnamespace.sip.old	2010-10-09 18:30:34.000000000 +0200
-+++ sip/QtCore/qnamespace.sip	2010-10-09 22:15:40.000000000 +0200
-@@ -1502,7 +1502,7 @@
+--- sip/QtCore/qnamespace.sip.old	2012-10-04 17:51:55.056239142 +0200
++++ sip/QtCore/qnamespace.sip	2012-10-04 17:51:55.060239142 +0200
+@@ -1507,7 +1507,7 @@
      };
  
      typedef QFlags<Qt::MatchFlag> MatchFlags;
      typedef void *HANDLE;
  %End
  %If (WS_X11)
-@@ -1715,6 +1715,7 @@
+@@ -1729,6 +1729,7 @@
  %If (Qt_4_6_0 -)
      typedef QFlags<Qt::TouchPointState> TouchPointStates;
  %End
  %If (Qt_4_6_0 -)
  
      enum GestureState
-@@ -1754,6 +1755,7 @@
+@@ -1768,6 +1769,7 @@
  %If (Qt_4_6_0 -)
      typedef QFlags<Qt::GestureFlag> GestureFlags;
  %End
  %If (Qt_4_6_0 -)
  
      enum NavigationMode
-@@ -1790,5 +1792,7 @@
+@@ -1992,5 +1994,7 @@
  QFlags<Qt::TouchPointState> operator|(Qt::TouchPointState f1, QFlags<Qt::TouchPointState> f2);
  %End
  %If (Qt_4_6_0 -)

PyQt4-Qt-Embedded-Linux-patches/sip/QtCore/qobject.sip.diff

---- sip/QtCore/qobject.sip.old	2010-09-12 00:44:24.000000000 +0200
-+++ sip/QtCore/qobject.sip	2010-09-12 00:56:11.000000000 +0200
-@@ -166,31 +166,41 @@
+--- sip/QtCore/qobject.sip.old	2012-10-04 17:51:55.068239142 +0200
++++ sip/QtCore/qobject.sip	2012-10-04 17:51:55.076239142 +0200
+@@ -243,31 +243,41 @@
          int yes, no;
      } graph[] = {
      #if QT_VERSION >= 0x040400
          {sipName_QAbstractTransition, &sipType_QAbstractTransition, 30, 14},
      #else
          {0, 0, 30, 14},
-@@ -202,20 +212,24 @@
+@@ -279,20 +289,24 @@
          {0, 0, -1, 16},
      #endif
          {sipName_QAbstractItemModel, &sipType_QAbstractItemModel, 32, 17},
          {sipName_QState, &sipType_QState, 25, 23},
          {sipName_QFinalState, &sipType_QFinalState, -1, 24},
          {sipName_QHistoryState, &sipType_QHistoryState, -1, -1},
-@@ -228,9 +242,13 @@
+@@ -305,9 +319,13 @@
      #endif
          {sipName_QBuffer, &sipType_QBuffer, -1, 27},
          {sipName_QFile, &sipType_QFile, 29, 28},
          {sipName_QEventTransition, &sipType_QEventTransition, -1, 31},
          {sipName_QSignalTransition, &sipType_QSignalTransition, -1, -1},
      #else
-@@ -239,7 +257,7 @@
+@@ -316,7 +334,7 @@
      #endif
          {sipName_QAbstractListModel, &sipType_QAbstractListModel, -1, 33},
          {sipName_QAbstractTableModel, &sipType_QAbstractTableModel, -1, -1},
          {sipName_QAnimationGroup, &sipType_QAnimationGroup, 37, 35},
          {sipName_QVariantAnimation, &sipType_QVariantAnimation, 39, 36},
          {sipName_QPauseAnimation, &sipType_QPauseAnimation, -1, -1},
-@@ -284,6 +302,7 @@
+@@ -362,6 +380,7 @@
      const QMetaObject *metaObject() const;
      explicit QObject(QObject *parent /TransferThis/ = 0);
      virtual ~QObject();
      void pyqtConfigure(SIP_PYOBJECT) /NoArgParser/;
  %Docstring
  QObject.pyqtConfigure(...)
-@@ -316,6 +335,7 @@
+@@ -394,6 +413,7 @@
          Py_INCREF(Py_None);
          return Py_None;
  %End
 +%End
  
-     virtual bool event(QEvent *);
-     virtual bool eventFilter(QObject *, QEvent *);
-@@ -377,6 +397,7 @@
+     SIP_PYOBJECT __getattr__(const char *name) const;
+ %MethodCode
+@@ -461,6 +481,7 @@
  %End
  
  %End
  %If (Qt_4_2_0 -)
      QString trUtf8(SIP_PYOBJECT sourceText /DocType="str"/, const char *disambiguation = 0, int n = -1) const;
  %MethodCode
-@@ -435,6 +456,7 @@
+@@ -519,6 +540,7 @@
  %End
  
  %End
 +%End
      SIP_PYOBJECT findChild(SIP_PYTYPE type, const QString &name /DocValue="Py_v3:''"/ = QString()) const /DocType="QObject"/;
  %MethodCode
-         sipRes = qtcore_FindChild(sipCpp, (PyTypeObject *)a0, *a1);
-@@ -472,8 +494,10 @@
+         sipRes = qtcore_FindChild(sipCpp, qtcore_type_to_tuple(a0), *a1);
+@@ -578,8 +600,10 @@
      bool isWidgetType() const;
      bool signalsBlocked() const;
      bool blockSignals(bool b);
      int startTimer(int interval);
      void killTimer(int id);
      const QObjectList &children() const;
-@@ -507,11 +531,13 @@
+@@ -613,11 +637,13 @@
  
      void dumpObjectInfo();
      void dumpObjectTree();

PyQt4-Qt-Embedded-Linux-patches/sip/QtCore/qpoint.sip.diff

---- sip/QtCore/qpoint.sip.old	2010-09-07 01:49:30.000000000 +0200
-+++ sip/QtCore/qpoint.sip	2010-09-07 01:50:10.000000000 +0200
-@@ -76,8 +76,10 @@
- %End
+--- sip/QtCore/qpoint.sip.old	2012-10-04 17:51:54.952239141 +0200
++++ sip/QtCore/qpoint.sip	2012-10-04 17:51:54.956239141 +0200
+@@ -89,8 +89,10 @@
+     QPoint &operator/=(qreal c);
  };
  
 +%If (PyQt_DataStream)

PyQt4-Qt-Embedded-Linux-patches/sip/QtCore/qprocess.sip.diff

---- sip/QtCore/qprocess.sip.old	2010-09-07 01:54:47.000000000 +0200
-+++ sip/QtCore/qprocess.sip	2010-09-07 01:56:35.000000000 +0200
-@@ -29,11 +29,12 @@
+--- sip/QtCore/qprocess.sip.old	2012-10-04 17:51:54.824239142 +0200
++++ sip/QtCore/qprocess.sip	2012-10-04 17:51:54.828239142 +0200
+@@ -24,11 +24,12 @@
  // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  
  typedef qint64 Q_PID;
  %End
  
-@@ -231,3 +232,4 @@
+@@ -232,3 +233,4 @@
  };
  
  %End

PyQt4-Qt-Embedded-Linux-patches/sip/QtCore/qreadwritelock.sip.diff

---- sip/QtCore/qreadwritelock.sip.old	2012-09-23 23:16:38.000000000 +0200
-+++ sip/QtCore/qreadwritelock.sip	2012-09-23 23:21:20.000000000 +0200
+--- sip/QtCore/qreadwritelock.sip.old	2012-10-04 17:51:54.940239141 +0200
++++ sip/QtCore/qreadwritelock.sip	2012-10-04 17:51:54.948239141 +0200
 @@ -33,6 +33,7 @@
  
  public:
  
      enum RecursionMode
      {
-@@ -48,8 +49,10 @@
-     QReadWriteLock();
+@@ -41,10 +42,13 @@
+     };
+ 
  %End
  %If (Qt_4_4_0 - Qt_5_0_0)
 +%If (PyQt_Thread)

PyQt4-Qt-Embedded-Linux-patches/sip/QtCore/qrect.sip.diff

---- sip/QtCore/qrect.sip.old	2010-09-07 01:59:16.000000000 +0200
-+++ sip/QtCore/qrect.sip	2010-09-07 01:59:51.000000000 +0200
-@@ -147,8 +147,10 @@
+--- sip/QtCore/qrect.sip.old	2012-10-04 17:51:54.876239143 +0200
++++ sip/QtCore/qrect.sip	2012-10-04 17:51:54.880239143 +0200
+@@ -153,8 +153,10 @@
  %End
  };
  
  bool operator==(const QRect &r1, const QRect &r2);
  bool operator!=(const QRect &r1, const QRect &r2);
  
-@@ -289,7 +291,9 @@
+@@ -307,7 +309,9 @@
  %End
  };
  

PyQt4-Qt-Embedded-Linux-patches/sip/QtCore/qregexp.sip.diff

---- sip/QtCore/qregexp.sip.old	2010-09-07 01:50:59.000000000 +0200
-+++ sip/QtCore/qregexp.sip	2010-09-07 01:51:35.000000000 +0200
-@@ -148,5 +148,7 @@
+--- sip/QtCore/qregexp.sip.old	2012-10-04 17:51:55.024239141 +0200
++++ sip/QtCore/qregexp.sip	2012-10-04 17:51:55.028239141 +0200
+@@ -146,5 +146,7 @@
  %End
  };
  

PyQt4-Qt-Embedded-Linux-patches/sip/QtCore/qsettings.sip.diff

---- sip/QtCore/qsettings.sip.old	2010-09-11 23:06:53.000000000 +0200
-+++ sip/QtCore/qsettings.sip	2010-09-12 00:18:26.000000000 +0200
-@@ -105,6 +105,7 @@
+--- sip/QtCore/qsettings.sip.old	2012-10-04 17:51:55.144239142 +0200
++++ sip/QtCore/qsettings.sip	2012-10-04 17:51:55.148239141 +0200
+@@ -114,6 +114,7 @@
  %If (Qt_4_4_0 -)
      static QSettings::Format defaultFormat();
  %End
 +%If (PyQt_TextCodec)
  %If (Qt_4_5_0 -)
-     void setIniCodec(QTextCodec *);
+     void setIniCodec(QTextCodec *codec /KeepReference/);
  %End
-@@ -114,6 +115,7 @@
+@@ -123,6 +124,7 @@
  %If (Qt_4_5_0 -)
      QTextCodec *iniCodec() const;
  %End
 +%End
  
  protected:
-     virtual bool event(QEvent *);
+     virtual bool event(QEvent *event);

PyQt4-Qt-Embedded-Linux-patches/sip/QtCore/qsharedmemory.sip.diff

---- sip/QtCore/qsharedmemory.sip.old	2009-06-14 22:29:33.000000000 +0200
-+++ sip/QtCore/qsharedmemory.sip	2009-06-14 22:29:33.000000000 +0200
-@@ -84,8 +84,10 @@
+--- sip/QtCore/qsharedmemory.sip.old	2012-10-04 17:51:54.980239141 +0200
++++ sip/QtCore/qsharedmemory.sip	2012-10-04 17:51:54.984239141 +0200
+@@ -73,8 +73,10 @@
          sipRes = sipConvertFromConstVoidPtrAndSize(sipCpp->constData(), sipCpp->size());
  %End
  
 +%End
      QSharedMemory::SharedMemoryError error() const;
      QString errorString() const;
- 
+ %If (Qt_4_8_0 -)

PyQt4-Qt-Embedded-Linux-patches/sip/QtCore/qsize.sip.diff

---- sip/QtCore/qsize.sip.old	2010-09-07 01:38:01.000000000 +0200
-+++ sip/QtCore/qsize.sip	2010-09-07 01:38:41.000000000 +0200
-@@ -82,8 +82,10 @@
+--- sip/QtCore/qsize.sip.old	2012-10-04 17:51:54.888239143 +0200
++++ sip/QtCore/qsize.sip	2012-10-04 17:51:54.892239143 +0200
+@@ -87,8 +87,10 @@
      QSize boundedTo(const QSize &otherSize) const;
  };
  

PyQt4-Qt-Embedded-Linux-patches/sip/QtCore/qstate.sip.diff

---- sip/QtCore/qstate.sip.old	2010-09-12 01:02:25.000000000 +0200
-+++ sip/QtCore/qstate.sip	2010-09-12 00:53:42.000000000 +0200
-@@ -75,7 +75,9 @@
+--- sip/QtCore/qstate.sip.old	2012-10-04 17:51:54.932239141 +0200
++++ sip/QtCore/qstate.sip	2012-10-04 17:51:54.936239141 +0200
+@@ -73,7 +73,9 @@
      void setInitialState(QAbstractState *state /KeepReference/);
      QState::ChildMode childMode() const;
      void setChildMode(QState::ChildMode mode);

PyQt4-Qt-Embedded-Linux-patches/sip/QtCore/qstatemachine.sip.diff

---- sip/QtCore/qstatemachine.sip.old	2010-09-12 01:01:20.000000000 +0200
-+++ sip/QtCore/qstatemachine.sip	2010-09-12 00:58:02.000000000 +0200
-@@ -92,11 +92,13 @@
+--- sip/QtCore/qstatemachine.sip.old	2012-10-04 17:51:55.088239142 +0200
++++ sip/QtCore/qstatemachine.sip	2012-10-04 17:51:55.096239142 +0200
+@@ -87,11 +87,13 @@
      QString errorString() const;
      void clearError();
      bool isRunning() const;

PyQt4-Qt-Embedded-Linux-patches/sip/QtCore/qstring.sip.diff

---- sip/QtCore/qstring.sip.old	2010-09-11 00:04:08.000000000 +0200
-+++ sip/QtCore/qstring.sip	2010-09-11 00:07:19.000000000 +0200
-@@ -88,7 +88,9 @@
+--- sip/QtCore/qstring.sip.old	2012-10-04 17:51:55.132239142 +0200
++++ sip/QtCore/qstring.sip	2012-10-04 17:51:55.136239143 +0200
+@@ -83,7 +83,9 @@
  
  
  // This is needed by the %BIGetCharBufferCode.
  %End
  
  %ConvertToTypeCode
-@@ -206,6 +208,7 @@
+@@ -201,6 +203,7 @@
      }
      else
      {
          static QTextCodec *codec = 0;
          static bool check_codec = TRUE;
      
-@@ -223,6 +226,9 @@
+@@ -218,6 +221,9 @@
          if (codec)
              enc = codec->fromUnicode(*sipCpp);
          else
              enc = sipCpp->toAscii();
      
          // A Python string is the most convenient method to save the encoded
-@@ -600,8 +606,10 @@
+@@ -620,8 +626,10 @@
  const QString operator+(QChar s1, const QString &s2) /Numeric/;
  const QString operator+(const QByteArray &ba, const QString &s) /Numeric/;
  const QString operator+(const QString &s, const QByteArray &ba) /Numeric/;

PyQt4-Qt-Embedded-Linux-patches/sip/QtCore/qstringlist.sip.diff

---- sip/QtCore/qstringlist.sip.old	2010-09-07 02:00:38.000000000 +0200
-+++ sip/QtCore/qstringlist.sip	2010-09-07 02:01:06.000000000 +0200