[SCM] PyKDE4 packaging branch, master, updated. debian/4.8.4-2

Maximiliano Curia maxy at alioth.debian.org
Thu Jun 13 13:02:54 UTC 2013


Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-sc/pykde4.git;a=commitdiff;h=b0afe54

The following commit has been merged in the master branch:
commit b0afe546f362a793a7734d45d1be519170462bb4
Author: Maximiliano Curia <maxy at debian.org>
Date:   Thu Jun 13 14:57:48 2013 +0200

    Forgot to add the new files
---
 debian/patches/cmake_no_bytecode.diff              |   32 +++++++
 .../patches/kpythonpluginfactory_3.2support.diff   |   42 +++++++++
 debian/patches/new_pyincludes.diff                 |   22 +++++
 debian/patches/python3_sip_options.diff            |   53 +++++++++++
 debian/patches/pythonpluginfactory_python3.diff    |   99 ++++++++++++++++++++
 5 files changed, 248 insertions(+)

diff --git a/debian/patches/cmake_no_bytecode.diff b/debian/patches/cmake_no_bytecode.diff
new file mode 100644
index 0000000..d682a61
--- /dev/null
+++ b/debian/patches/cmake_no_bytecode.diff
@@ -0,0 +1,32 @@
+Index: pykde4-4.8.4/cmake/modules/PythonMacros.cmake
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ pykde4-4.8.4/cmake/modules/PythonMacros.cmake	2013-05-20 01:35:17.817291741 -0400
+@@ -0,0 +1,27 @@
++# Python macros
++# ~~~~~~~~~~~~~
++# Copyright (c) 2007, Simon Edwards <simon at simonzone.com>
++# Cloned-and-hacked by Colin Watson <cjwatson at ubuntu.com>, removing bytecode
++# support.
++#
++# Redistribution and use is allowed according to the terms of the BSD license.
++# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
++#
++# This file defines the following macros:
++#
++# PYTHON_INSTALL (SOURCE_FILE DESINATION_DIR)
++#     Install the SOURCE_FILE, which is a Python .py file, into the
++#     destination directory during install.
++
++GET_FILENAME_COMPONENT(PYTHON_MACROS_MODULE_PATH ${CMAKE_CURRENT_LIST_FILE}  PATH)
++
++MACRO(PYTHON_INSTALL SOURCE_FILE DESINATION_DIR)
++
++  FIND_FILE(_python_compile_py PythonCompile.py PATHS ${CMAKE_MODULE_PATH})
++
++  ADD_CUSTOM_TARGET(compile_python_files ALL)
++
++  # Install the source file.
++  INSTALL(FILES ${SOURCE_FILE} DESTINATION ${DESINATION_DIR})
++ENDMACRO(PYTHON_INSTALL)
++
diff --git a/debian/patches/kpythonpluginfactory_3.2support.diff b/debian/patches/kpythonpluginfactory_3.2support.diff
new file mode 100644
index 0000000..072a33b
--- /dev/null
+++ b/debian/patches/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/debian/patches/new_pyincludes.diff b/debian/patches/new_pyincludes.diff
new file mode 100644
index 0000000..27dffb6
--- /dev/null
+++ b/debian/patches/new_pyincludes.diff
@@ -0,0 +1,22 @@
+Index: pykde4-4.8.4/CMakeLists.txt
+===================================================================
+--- pykde4-4.8.4.orig/CMakeLists.txt	2013-05-17 18:34:50.000000000 -0400
++++ pykde4-4.8.4/CMakeLists.txt	2013-05-20 00:55:07.657362953 -0400
+@@ -26,6 +26,7 @@
+ 
+ FIND_PACKAGE(PythonLibrary REQUIRED)
+ INCLUDE(PythonMacros)
++FIND_PACKAGE(PythonLibs)
+ 
+ FIND_PACKAGE(SIP REQUIRED)
+ IF(SIP_VERSION STRLESS "040c00")    # These version numbers also appear in ../CMakeLists.txt
+@@ -60,7 +61,8 @@
+ ENDIF (${PYTHON_SHORT_VERSION} MATCHES "^3")
+ 
+ INCLUDE_DIRECTORIES(
+-    ${PYTHON_INCLUDE_PATH}
++    ${PYTHON_INCLUDE_DIR}
++    ${PYTHON_INCLUDE_DIR2}
+     ${SIP_INCLUDE_DIR}
+     ${QT_INCLUDE_DIR}
+     ${QT_QT_INCLUDE_DIR}
diff --git a/debian/patches/python3_sip_options.diff b/debian/patches/python3_sip_options.diff
new file mode 100644
index 0000000..7e42e98
--- /dev/null
+++ b/debian/patches/python3_sip_options.diff
@@ -0,0 +1,53 @@
+Already upstream, can be dropped with 4.10.
+
+Index: pykde4-4.8.4/CMakeLists.txt
+===================================================================
+--- pykde4-4.8.4.orig/CMakeLists.txt	2013-05-20 08:29:21.213422712 -0400
++++ pykde4-4.8.4/CMakeLists.txt	2013-05-20 08:29:21.205422712 -0400
+@@ -101,11 +101,21 @@
+ SET(SIP_DISABLE_FEATURES VendorID PyQt_NoPrintRangeBug ${SIP_ARM_HACK})
+ 
+ # Use an extra option when compiling on Python 3.
+-IF (PYTHON_3)
+-    SET(SIP_EXTRA_OPTIONS -g -x Py_v3)
+-ELSE (PYTHON_3)
+-    SET(SIP_EXTRA_OPTIONS -g)
+-ENDIF (PYTHON_3)
++if (PYTHON_3)
++    if(PYQT4_VERSION STRGREATER "040904")
++            # Disable for newer PyQt
++            set(SIP_EXTRA_OPTIONS -g -x PyKDE_QVector)
++    else ()
++            set(SIP_EXTRA_OPTIONS -g)
++    endif()
++else (PYTHON_3)
++    if(PYQT4_VERSION STRGREATER "040904")
++        # Disable for newer PyQt
++        set(SIP_EXTRA_OPTIONS -g -x PyKDE_QVector -x Py_v3)
++    else ()
++            set(SIP_EXTRA_OPTIONS -g -x Py_v3)
++    endif()
++endif ()
+ 
+ ADD_DEFINITIONS(-D_REENTRANT -DQT_CORE_LIB -DQT_GUI_LIB -DUSING_SOPRANO_NRLMODEL_UNSTABLE_API)
+ 
+Index: pykde4-4.8.4/sip/kdecore/typedefs.sip
+===================================================================
+--- pykde4-4.8.4.orig/sip/kdecore/typedefs.sip	2013-05-20 08:30:20.041420973 -0400
++++ pykde4-4.8.4/sip/kdecore/typedefs.sip	2013-05-20 08:31:09.489419512 -0400
+@@ -951,6 +951,10 @@
+ %End
+ };
+ 
++%Feature PyKDE_QVector
++
++%If(PyKDE_QVector)
++
+ %MappedType QVector<int>
+ {
+ %TypeHeaderCode
+@@ -1025,3 +1029,4 @@
+     return sipGetState(sipTransferObj);
+ %End
+ };
++%End
diff --git a/debian/patches/pythonpluginfactory_python3.diff b/debian/patches/pythonpluginfactory_python3.diff
new file mode 100644
index 0000000..29691f8
--- /dev/null
+++ b/debian/patches/pythonpluginfactory_python3.diff
@@ -0,0 +1,99 @@
+Enable kpythonpluginfactory to build for Python 3 as well.  Should be
+upstreamed after more testing.
+Note: It is OK for the Python and Python3 versions to have the same name
+because of the version specific ABI tags in Python 3 so files and the fact
+that Python 3 interpreters will search for those first.
+Copyright (C) 2012 Barry A. Warsaw <barry at python.org>
+Index: pykde4-4.8.4/kpythonpluginfactory/kpythonpluginfactory.cpp
+===================================================================
+--- pykde4-4.8.4.orig/kpythonpluginfactory/kpythonpluginfactory.cpp	2013-05-20 02:27:28.047014262 -0400
++++ pykde4-4.8.4/kpythonpluginfactory/kpythonpluginfactory.cpp	2013-05-20 02:27:28.039014262 -0400
+@@ -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 @@
+     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 @@
+     }
+     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);
+Index: pykde4-4.8.4/CMakeLists.txt
+===================================================================
+--- pykde4-4.8.4.orig/CMakeLists.txt	2013-05-20 02:27:28.047014262 -0400
++++ pykde4-4.8.4/CMakeLists.txt	2013-05-20 02:30:31.627008838 -0400
+@@ -277,7 +277,9 @@
+ ADD_SUBDIRECTORY(tools)
+ #ADD_SUBDIRECTORY(docs)
+ ADD_SUBDIRECTORY(examples)
+-IF (NOT PYTHON_3 AND DEFAULT_PYTHON_VERSION)
++IF ((NOT PYTHON_3 AND DEFAULT_PYTHON_VERSION) OR PYTHON_3)
++# Due to version specific ABI tagging in Python 3 so files, we can build for
++# all Python 3 versions without a problem.
+     ADD_SUBDIRECTORY(kpythonpluginfactory)
+-ENDIF (NOT PYTHON_3 AND DEFAULT_PYTHON_VERSION)
++ENDIF ((NOT PYTHON_3 AND DEFAULT_PYTHON_VERSION) OR PYTHON_3)
+ #ADD_SUBDIRECTORY(pykdedocs)

-- 
PyKDE4 packaging



More information about the pkg-kde-commits mailing list