[pykde4] rebuild (sip/PyQt4), rebase patches

Rex Dieter rdieter at fedoraproject.org
Wed Oct 16 21:39:34 UTC 2013


commit 09c35360e11025177430662b6a8fdf0dd7b3ed11
Author: Rex Dieter <rdieter at math.unl.edu>
Date:   Wed Oct 16 16:39:33 2013 -0500

    rebuild (sip/PyQt4), rebase patches

 add_qt_kde_definitions.diff                       |   20 +++++
 fix_kpythonpluginfactory_build.diff               |    6 +-
 kubuntu_kpythonpluginfactory_3.2support.diff      |   42 ++++++++++
 make_pykde4_respect_sip_flags.diff                |   32 +++++++
 pykde4-4.11.2-pythonpluginfactory_python3.patch   |   90 +++++++++++++++++++++
 pykde4-4.9.90-respect_sip_flags.patch             |   22 -----
 pykde4.spec                                       |   26 +++++--
 pythonpluginfactory_use_versioned_python_lib.diff |   21 +++++
 8 files changed, 229 insertions(+), 30 deletions(-)
---
diff --git a/add_qt_kde_definitions.diff b/add_qt_kde_definitions.diff
new file mode 100644
index 0000000..e64d6ab
--- /dev/null
+++ b/add_qt_kde_definitions.diff
@@ -0,0 +1,20 @@
+From: Sune Vuorela <sune at debian.org>
+From: Modestas Vainius <modax at debian.org>
+Subject: define Qt/KDE definitions when building standalone
+Forwarded: no
+Last-Update: 2011-06-30
+Origin: vendor
+
+Index: b/CMakeLists.txt
+===================================================================
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -35,6 +35,8 @@ set_package_properties(PythonInterp PROP
+ 
+ include_directories(${KDE4_INCLUDES})
+ 
++add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS} -DQT3_SUPPORT)
++
+ find_package(SIP)
+ set_package_properties(SIP PROPERTIES DESCRIPTION "The SIP binding generator"
+                        URL "http://riverbankcomputing.com" TYPE REQUIRED
diff --git a/fix_kpythonpluginfactory_build.diff b/fix_kpythonpluginfactory_build.diff
index 4fe6223..71f5928 100644
--- a/fix_kpythonpluginfactory_build.diff
+++ b/fix_kpythonpluginfactory_build.diff
@@ -4,8 +4,10 @@ Forwarded: no
 Origin: vendor
 Last-Update: 2008-12-05
 
---- a/kpythonpluginfactory/kpythonpluginfactory.cpp
-+++ b/kpythonpluginfactory/kpythonpluginfactory.cpp
+Index: pykde4-4.9.80/kpythonpluginfactory/kpythonpluginfactory.cpp
+===================================================================
+--- pykde4-4.9.80.orig/kpythonpluginfactory/kpythonpluginfactory.cpp	2012-11-14 16:14:05.000000000 +0000
++++ pykde4-4.9.80/kpythonpluginfactory/kpythonpluginfactory.cpp	2012-11-19 17:23:32.497203781 +0000
 @@ -18,6 +18,7 @@
     Boston, MA 02111-1307, USA.
  */
diff --git a/kubuntu_kpythonpluginfactory_3.2support.diff b/kubuntu_kpythonpluginfactory_3.2support.diff
new file mode 100644
index 0000000..072a33b
--- /dev/null
+++ b/kubuntu_kpythonpluginfactory_3.2support.diff
@@ -0,0 +1,42 @@
+Index: b/kpythonpluginfactory/kpythonpluginfactory.cpp
+===================================================================
+--- a/kpythonpluginfactory/kpythonpluginfactory.cpp
++++ b/kpythonpluginfactory/kpythonpluginfactory.cpp
+@@ -33,6 +33,12 @@
+ #define PY3
+ #endif
+ 
++#if PY_MAJOR_VERSION >= 3
++#if PY_MINOR_VERSION >= 2
++#define PY3.2
++#endif
++#endif
++
+ /*
+ This implements a plugin factory for running Python plugins. It also
+ supports io-slaves with a kdemain() entry point.
+@@ -106,8 +112,13 @@ void KPythonPluginFactory::initialize()
+         kDebug() << "Initializing Python interpreter.";
+         pythonLib = LoadPythonLibrary();
+ 
++#ifdef PY3.2
++        Py_Initialize ();
++        PyEval_InitThreads ();
++#else
+         PyEval_InitThreads ();
+         Py_Initialize ();
++#endif
+         if (!Py_IsInitialized ())
+         {
+             //pythonInit = 0;
+@@ -117,8 +128,10 @@ void KPythonPluginFactory::initialize()
+         kDebug() << "Succesfully initialized Python interpreter.";
+ 
+         threadState = PyThreadState_GET();
++#ifndef PY3.2
+         // free the lock
+         PyEval_ReleaseLock();
++#endif
+     }
+ }
+ 
diff --git a/make_pykde4_respect_sip_flags.diff b/make_pykde4_respect_sip_flags.diff
new file mode 100644
index 0000000..5a111b8
--- /dev/null
+++ b/make_pykde4_respect_sip_flags.diff
@@ -0,0 +1,32 @@
+From: Michael Casadevall <mcasadevall at debian.org>
+Subject: Respect Qt SIP flags
+Forwarded: no
+Origin:
+Last-Update: 2009-04-15
+
+Corrects FTBFS on armel by making sure pykde4 properly parses the python-qt4
+flags passed from PythonQt4's cmake file.
+
+Index: pykde4-4.11.1+git20130916/CMakeLists.txt
+===================================================================
+--- pykde4-4.11.1+git20130916.orig/CMakeLists.txt	2013-09-17 00:00:30.678363723 -0400
++++ pykde4-4.11.1+git20130916/CMakeLists.txt	2013-09-17 00:00:30.670363723 -0400
+@@ -103,6 +103,9 @@
+     ${KDEPIMLIBS_INCLUDE_DIRS}
+ )
+ 
++# Pull in ARM configuration options if needed
++STRING(REGEX MATCH "PyQt_qreal_double" SIP_ARM_HACK ${PYQT4_SIP_FLAGS} "")
++
+ set(SIP_INCLUDES ${PYQT4_SIP_DIR} sip)
+ set(SIP_CONCAT_PARTS 8)
+ if (WIN32)
+@@ -110,7 +113,7 @@
+ else ()
+     set(SIP_TAGS ALL WS_X11 ${PYQT4_VERSION_TAG})
+ endif ()
+-set(SIP_DISABLE_FEATURES VendorID PyQt_NoPrintRangeBug)
++set(SIP_DISABLE_FEATURES VendorID PyQt_NoPrintRangeBug ${SIP_ARM_HACK})
+ 
+ # Use an extra option when compiling on Python 3.
+ if (PYTHON_VERSION_MAJOR GREATER 2)
diff --git a/pykde4-4.11.2-pythonpluginfactory_python3.patch b/pykde4-4.11.2-pythonpluginfactory_python3.patch
new file mode 100644
index 0000000..cfde749
--- /dev/null
+++ b/pykde4-4.11.2-pythonpluginfactory_python3.patch
@@ -0,0 +1,90 @@
+diff -up pykde4-4.11.2/CMakeLists.txt.207 pykde4-4.11.2/CMakeLists.txt
+--- pykde4-4.11.2/CMakeLists.txt.207	2013-10-16 14:59:36.027327310 -0500
++++ pykde4-4.11.2/CMakeLists.txt	2013-10-16 15:00:13.068628265 -0500
+@@ -283,7 +283,9 @@ install(DIRECTORY sip/ DESTINATION ${SIP
+ add_subdirectory(tools)
+ #add_subdirectory(docs)
+ add_subdirectory(examples)
+-if (PYTHON_VERSION_MAJOR LESS 3)
++# Due to version specific ABI tagging in Python 3 so files, we can build for
++# all Python 3 versions without a problem.
++if ((PYTHON_VERSION_MAJOR LESS 3 AND DEFAULT_PYTHON_VERSION) OR PYTHON_VERSION_MAJOR GREATER 2)
+     add_subdirectory(kpythonpluginfactory)
+ endif ()
+ 
+diff -up pykde4-4.11.2/kpythonpluginfactory/kpythonpluginfactory.cpp.207 pykde4-4.11.2/kpythonpluginfactory/kpythonpluginfactory.cpp
+--- pykde4-4.11.2/kpythonpluginfactory/kpythonpluginfactory.cpp.207	2013-10-16 14:59:36.023327383 -0500
++++ pykde4-4.11.2/kpythonpluginfactory/kpythonpluginfactory.cpp	2013-10-16 14:59:36.026327328 -0500
+@@ -29,6 +29,10 @@
+ #include <kcomponentdata.h>
+ #include <kdebug.h>
+ 
++#if PY_MAJOR_VERSION >= 3
++#define PY3
++#endif
++
+ /*
+ This implements a plugin factory for running Python plugins. It also
+ supports io-slaves with a kdemain() entry point.
+@@ -347,17 +351,48 @@ int kdemain( int argc, char **argv )
+     PyObject *pModule;
+     char *protocol = argv[1];
+ 
++#ifdef PY3
++    /* Python 3 requires wchar_t*s for its Py_SetProgramName() and
++       PySys_SetArgv() calls.  Python 2 uses the typical char*s.  This is
++       probably not the best way to do it, but the algorithm is based on
++       Python 3's main().
++    */
++    wchar_t **program_args = (wchar_t **)PyMem_Malloc(
++        sizeof(wchar_t *) * (argc + 1));
++    char *old_locale;
++    const char *argv_i;
++
++    if (!program_args) {
++        /* out of memory */
++        Py_FatalError("out of memory");
++    }
++    for (int i = 0; i < argc; i++) {
++        program_args[i] = (wchar_t *)PyMem_Malloc(
++            sizeof(wchar_t) * (strlen(argv[i]) + 1));
++        if (!program_args[i]) {
++            Py_FatalError("out of memory");
++        }
++        argv_i = argv[i];
++        if (mbsrtowcs(program_args[i], &argv_i, strlen(argv[i]), NULL) < 0) {
++            /* The conversion failed. */
++            Py_FatalError("conversion to wchar_t* failed");
++        }
++    }
++#else
++    char **program_args = argv;
++#endif  // PY3
++
+     kDebug() << "Python kioslave starting";
+     KComponentData slave(protocol);
+     kDebug() << "Created KComponentData for protocol " << protocol;
+ 
+     QLibrary *pyLib = LoadPythonLibrary();
+ 
+-    Py_SetProgramName(argv[0]);
++    Py_SetProgramName(program_args[0]);
+     Py_Initialize();
+ 
+     //PyEval_InitThreads();
+-    PySys_SetArgv(1, argv);
++    PySys_SetArgv(1, program_args);
+ 
+     QString completePath = KStandardDirs::locate("data", QString("kio_python/%1/%2.py").arg(protocol).arg(protocol));
+     kDebug() << "Path to Python kioslace is " << completePath;
+@@ -388,8 +423,8 @@ int kdemain( int argc, char **argv )
+     }
+     PyObject *pClass, *pArgs, *pArg1, *pArg2;
+     pArgs = PyTuple_New(2);
+-    pArg1 = PyString_FromString(argv[2]);
+-    pArg2 = PyString_FromString(argv[3]);
++    pArg1 = PyBytes_FromString(argv[2]);
++    pArg2 = PyBytes_FromString(argv[3]);
+     PyTuple_SetItem(pArgs, 0, pArg1);
+     PyTuple_SetItem(pArgs, 1, pArg2);
+     RunFunction(factoryFunction, pArgs);
diff --git a/pykde4.spec b/pykde4.spec
index 5eab3c7..f110352 100644
--- a/pykde4.spec
+++ b/pykde4.spec
@@ -11,7 +11,7 @@
 
 Name:    pykde4 
 Version: 4.11.2
-Release: 1%{?dist}
+Release: 2%{?dist}
 Summary: Python bindings for KDE4 
 
 # http://techbase.kde.org/Policies/Licensing_Policy
@@ -34,8 +34,14 @@ Patch1: 0001-Ensure-SIP-files-are-installed-to-the-right-path-bas.patch
 ## upstream patches
 
 # debian patches
-Patch200: pykde4-4.9.90-respect_sip_flags.patch
-Patch201: fix_kpythonpluginfactory_build.diff
+Patch201: add_qt_kde_definitions.diff
+Patch202: fix_kpythonpluginfactory_build.diff
+Patch203: make_pykde4_respect_sip_flags.diff
+Patch204: pythonpluginfactory_use_versioned_python_lib.diff
+# rebased pythonpluginfactory_python3.diff
+Patch207: pykde4-4.11.2-pythonpluginfactory_python3.patch
+Patch209: kubuntu_kpythonpluginfactory_3.2support.diff
+
 
 # rhel patches
 Patch300: pykde4-4.8.3-webkit.patch
@@ -157,8 +163,13 @@ Provides:  python3-PyKDE4-devel%{?_isa} = %{version}-%{release}
 
 %patch1 -p1 -R -b .use_system_sip_dir
 
-%patch200 -p1 -b .respect_sip_flags
-%patch201 -p1 -b .kpythonpluginfactory_slots
+%patch201 -p1 -b .201
+%patch202 -p1 -b .202
+%patch203 -p1 -b .203
+# we set explicit PYTHON_LIBRARY below, so can avoid this
+#patch204 -p1 -b .204
+%patch207 -p1 -b .207
+%patch209 -p1 -b .209
 
 %if ! 0%{?webkit}
 %patch300 -p1 -b .webkit
@@ -194,7 +205,7 @@ popd
 %if 0%{?python3}
 make install/fast DESTDIR=%{buildroot} -C %{_target_cpu}-python3
 
-# not python3 compat yet
+# omit conflict with base kpythonpluginfactory
 rm -fv %{buildroot}%{_kde4_libdir}/kde4/kpythonpluginfactory.so 
 
 # HACK: fix multilib conflict, similar to PyQt4's http://bugzilla.redhat.com/509415
@@ -268,6 +279,9 @@ mv %{buildroot}%{_kde4_appsdir}/pykde4/examples/ %{buildroot}%{_docdir}/pykde4/
 
 
 %changelog
+* Wed Oct 16 2013 Rex Dieter <rdieter at fedoraproject.org> 4.11.2-2
+- rebuild (sip/PyQt4), rebase patches
+
 * Sat Sep 28 2013 Rex Dieter <rdieter at fedoraproject.org> - 4.11.2-1
 - 4.11.2
 
diff --git a/pythonpluginfactory_use_versioned_python_lib.diff b/pythonpluginfactory_use_versioned_python_lib.diff
new file mode 100644
index 0000000..7aa65a0
--- /dev/null
+++ b/pythonpluginfactory_use_versioned_python_lib.diff
@@ -0,0 +1,21 @@
+From: Sune Vuorela <sune at debian.org>
+Subject: Make kpythonfactory dlopen versioned python library.
+Bug-Debian: http://bugs.debian.org/524685
+Bug-Debian: http://bugs.debian.org/541999
+Last-Update: 2009-09-19
+Forwarded: no
+Origin: vendor
+
+Otherwise, python-dev would be needed for Python Plugin factory to work.
+
+--- a/kpythonpluginfactory/kpythonpluginfactory.cpp
++++ b/kpythonpluginfactory/kpythonpluginfactory.cpp
+@@ -307,7 +307,7 @@ QLibrary *LoadPythonLibrary()
+ {
+     QLibrary *pythonLib = new QLibrary();
+     pythonLib->setLoadHints(QLibrary::ExportExternalSymbolsHint);
+-    pythonLib->setFileName(LIB_PYTHON);
++    pythonLib->setFileName(LIB_PYTHON ".1");
+     pythonLib->load();
+     return pythonLib;
+ }


More information about the scm-commits mailing list