From 2d7cd2e51e7671919b7a5b327faa17642829b9e7 Mon Sep 17 00:00:00 2001 From: Alexpux Date: Sun, 2 Mar 2014 10:09:33 +0400 Subject: [PATCH] python{2+3}: Use gnu_printf in format to get working %z formatting. --- .../1030-use-gnu_printf-in-format.patch | 69 +++++++++++++++++++ mingw-w64-python2/PKGBUILD | 9 ++- .../0850-use-gnu_printf-in-format.patch | 60 ++++++++++++++++ mingw-w64-python3/PKGBUILD | 9 ++- 4 files changed, 141 insertions(+), 6 deletions(-) create mode 100644 mingw-w64-python2/1030-use-gnu_printf-in-format.patch create mode 100644 mingw-w64-python3/0850-use-gnu_printf-in-format.patch diff --git a/mingw-w64-python2/1030-use-gnu_printf-in-format.patch b/mingw-w64-python2/1030-use-gnu_printf-in-format.patch new file mode 100644 index 0000000000..7fe5554c2a --- /dev/null +++ b/mingw-w64-python2/1030-use-gnu_printf-in-format.patch @@ -0,0 +1,69 @@ +diff -Naur Python-2.7.6-orig/Include/pgenheaders.h Python-2.7.6/Include/pgenheaders.h +--- Python-2.7.6-orig/Include/pgenheaders.h 2014-03-02 01:18:51.954000000 +0400 ++++ Python-2.7.6/Include/pgenheaders.h 2014-03-02 01:22:32.397600000 +0400 +@@ -10,9 +10,9 @@ + #include "Python.h" + + PyAPI_FUNC(void) PySys_WriteStdout(const char *format, ...) +- Py_GCC_ATTRIBUTE((format(printf, 1, 2))); ++ Py_GCC_ATTRIBUTE((format(gnu_printf, 1, 2))); + PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...) +- Py_GCC_ATTRIBUTE((format(printf, 1, 2))); ++ Py_GCC_ATTRIBUTE((format(gnu_printf, 1, 2))); + + #define addarc _Py_addarc + #define addbit _Py_addbit +diff -Naur Python-2.7.6-orig/Include/pyerrors.h Python-2.7.6/Include/pyerrors.h +--- Python-2.7.6-orig/Include/pyerrors.h 2014-03-02 01:18:51.954000000 +0400 ++++ Python-2.7.6/Include/pyerrors.h 2014-03-02 01:22:13.396800000 +0400 +@@ -193,7 +193,7 @@ + #endif /* MS_WINDOWS */ + + PyAPI_FUNC(PyObject *) PyErr_Format(PyObject *, const char *, ...) +- Py_GCC_ATTRIBUTE((format(printf, 2, 3))); ++ Py_GCC_ATTRIBUTE((format(gnu_printf, 2, 3))); + + #ifdef MS_WINDOWS + PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilenameObject( +@@ -318,9 +318,9 @@ + + #include + PyAPI_FUNC(int) PyOS_snprintf(char *str, size_t size, const char *format, ...) +- Py_GCC_ATTRIBUTE((format(printf, 3, 4))); ++ Py_GCC_ATTRIBUTE((format(gnu_printf, 3, 4))); + PyAPI_FUNC(int) PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va) +- Py_GCC_ATTRIBUTE((format(printf, 3, 0))); ++ Py_GCC_ATTRIBUTE((format(gnu_printf, 3, 0))); + + #ifdef __cplusplus + } +diff -Naur Python-2.7.6-orig/Include/stringobject.h Python-2.7.6/Include/stringobject.h +--- Python-2.7.6-orig/Include/stringobject.h 2014-03-02 01:18:51.954000000 +0400 ++++ Python-2.7.6/Include/stringobject.h 2014-03-02 01:21:28.437600000 +0400 +@@ -62,9 +62,9 @@ + PyAPI_FUNC(PyObject *) PyString_FromStringAndSize(const char *, Py_ssize_t); + PyAPI_FUNC(PyObject *) PyString_FromString(const char *); + PyAPI_FUNC(PyObject *) PyString_FromFormatV(const char*, va_list) +- Py_GCC_ATTRIBUTE((format(printf, 1, 0))); ++ Py_GCC_ATTRIBUTE((format(gnu_printf, 1, 0))); + PyAPI_FUNC(PyObject *) PyString_FromFormat(const char*, ...) +- Py_GCC_ATTRIBUTE((format(printf, 1, 2))); ++ Py_GCC_ATTRIBUTE((format(gnu_printf, 1, 2))); + PyAPI_FUNC(Py_ssize_t) PyString_Size(PyObject *); + PyAPI_FUNC(char *) PyString_AsString(PyObject *); + PyAPI_FUNC(PyObject *) PyString_Repr(PyObject *, int); +diff -Naur Python-2.7.6-orig/Include/sysmodule.h Python-2.7.6/Include/sysmodule.h +--- Python-2.7.6-orig/Include/sysmodule.h 2014-03-02 01:18:51.969600000 +0400 ++++ Python-2.7.6/Include/sysmodule.h 2014-03-02 01:19:24.729600000 +0400 +@@ -15,9 +15,9 @@ + PyAPI_FUNC(void) PySys_SetPath(char *); + + PyAPI_FUNC(void) PySys_WriteStdout(const char *format, ...) +- Py_GCC_ATTRIBUTE((format(printf, 1, 2))); ++ Py_GCC_ATTRIBUTE((format(gnu_printf, 1, 2))); + PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...) +- Py_GCC_ATTRIBUTE((format(printf, 1, 2))); ++ Py_GCC_ATTRIBUTE((format(gnu_printf, 1, 2))); + + PyAPI_FUNC(void) PySys_ResetWarnOptions(void); + PyAPI_FUNC(void) PySys_AddWarnOption(char *); diff --git a/mingw-w64-python2/PKGBUILD b/mingw-w64-python2/PKGBUILD index cdfad08c94..cb9463d09a 100644 --- a/mingw-w64-python2/PKGBUILD +++ b/mingw-w64-python2/PKGBUILD @@ -5,7 +5,7 @@ _realname=python2 _mingw_suff=mingw-w64-${CARCH} pkgname="${_mingw_suff}-${_realname}" pkgver=2.7.6 -pkgrel=9 +pkgrel=10 _pybasever=2.7 pkgdesc="A high-level scripting language (mingw-w64)" arch=('any') @@ -95,7 +95,8 @@ source=("http://www.python.org/ftp/python/${pkgver%rc?}/Python-${pkgver}.tar.xz" 0850-cross-PYTHON_FOR_BUILD-gteq-276-and-fullpath-it.patch 1000-dont-link-with-gettext.patch 1010-ctypes-python-dll.patch - 1020-gdbm-module-includes.patch) + 1020-gdbm-module-includes.patch + 1030-use-gnu_printf-in-format.patch) prepare() { @@ -185,6 +186,7 @@ prepare() { patch -p1 -i "${srcdir}"/1000-dont-link-with-gettext.patch patch -p1 -i "${srcdir}"/1010-ctypes-python-dll.patch patch -p1 -i "${srcdir}"/1020-gdbm-module-includes.patch + patch -p1 -i "${srcdir}"/1030-use-gnu_printf-in-format.patch autoreconf -vfi @@ -386,4 +388,5 @@ sha1sums=('8321636af2acbeaa68fc635d7dda7369ed446a80' 'c9d6321fbdb9067fa18cd1aebba216e87c9be4d4' '0f38980482673a50845cf2f4e1339194210968bd' '35262922a607e0cc0ee6d6d789004a069986eb8e' - '23f78a2af387fe4d782be16362c8589dc10ca77b') + '23f78a2af387fe4d782be16362c8589dc10ca77b' + '052ffdc59f589373ef52c3cb0868daccfc4ccb1e') diff --git a/mingw-w64-python3/0850-use-gnu_printf-in-format.patch b/mingw-w64-python3/0850-use-gnu_printf-in-format.patch new file mode 100644 index 0000000000..dd79be9283 --- /dev/null +++ b/mingw-w64-python3/0850-use-gnu_printf-in-format.patch @@ -0,0 +1,60 @@ +diff -Naur Python-3.3.3-orig/Include/bytesobject.h Python-3.3.3/Include/bytesobject.h +--- Python-3.3.3-orig/Include/bytesobject.h 2013-11-17 11:22:23.000000000 +0400 ++++ Python-3.3.3/Include/bytesobject.h 2014-03-02 01:37:06.454400000 +0400 +@@ -52,9 +52,9 @@ + PyAPI_FUNC(PyObject *) PyBytes_FromString(const char *); + PyAPI_FUNC(PyObject *) PyBytes_FromObject(PyObject *); + PyAPI_FUNC(PyObject *) PyBytes_FromFormatV(const char*, va_list) +- Py_GCC_ATTRIBUTE((format(printf, 1, 0))); ++ Py_GCC_ATTRIBUTE((format(gnu_printf, 1, 0))); + PyAPI_FUNC(PyObject *) PyBytes_FromFormat(const char*, ...) +- Py_GCC_ATTRIBUTE((format(printf, 1, 2))); ++ Py_GCC_ATTRIBUTE((format(gnu_printf, 1, 2))); + PyAPI_FUNC(Py_ssize_t) PyBytes_Size(PyObject *); + PyAPI_FUNC(char *) PyBytes_AsString(PyObject *); + PyAPI_FUNC(PyObject *) PyBytes_Repr(PyObject *, int); +diff -Naur Python-3.3.3-orig/Include/pgenheaders.h Python-3.3.3/Include/pgenheaders.h +--- Python-3.3.3-orig/Include/pgenheaders.h 2013-11-17 11:22:24.000000000 +0400 ++++ Python-3.3.3/Include/pgenheaders.h 2014-03-02 01:37:45.844400000 +0400 +@@ -10,9 +10,9 @@ + #include "Python.h" + + PyAPI_FUNC(void) PySys_WriteStdout(const char *format, ...) +- Py_GCC_ATTRIBUTE((format(printf, 1, 2))); ++ Py_GCC_ATTRIBUTE((format(gnu_printf, 1, 2))); + PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...) +- Py_GCC_ATTRIBUTE((format(printf, 1, 2))); ++ Py_GCC_ATTRIBUTE((format(gnu_printf, 1, 2))); + + #define addarc _Py_addarc + #define addbit _Py_addbit +diff -Naur Python-3.3.3-orig/Include/pyerrors.h Python-3.3.3/Include/pyerrors.h +--- Python-3.3.3-orig/Include/pyerrors.h 2013-11-17 11:22:24.000000000 +0400 ++++ Python-3.3.3/Include/pyerrors.h 2014-03-02 01:38:21.428000000 +0400 +@@ -416,9 +416,9 @@ + + #include + PyAPI_FUNC(int) PyOS_snprintf(char *str, size_t size, const char *format, ...) +- Py_GCC_ATTRIBUTE((format(printf, 3, 4))); ++ Py_GCC_ATTRIBUTE((format(gnu_printf, 3, 4))); + PyAPI_FUNC(int) PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va) +- Py_GCC_ATTRIBUTE((format(printf, 3, 0))); ++ Py_GCC_ATTRIBUTE((format(gnu_printf, 3, 0))); + + #ifdef __cplusplus + } +diff -Naur Python-3.3.3-orig/Include/sysmodule.h Python-3.3.3/Include/sysmodule.h +--- Python-3.3.3-orig/Include/sysmodule.h 2013-11-17 11:22:24.000000000 +0400 ++++ Python-3.3.3/Include/sysmodule.h 2014-03-02 01:38:59.835200000 +0400 +@@ -14,9 +14,9 @@ + PyAPI_FUNC(void) PySys_SetPath(const wchar_t *); + + PyAPI_FUNC(void) PySys_WriteStdout(const char *format, ...) +- Py_GCC_ATTRIBUTE((format(printf, 1, 2))); ++ Py_GCC_ATTRIBUTE((format(gnu_printf, 1, 2))); + PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...) +- Py_GCC_ATTRIBUTE((format(printf, 1, 2))); ++ Py_GCC_ATTRIBUTE((format(gnu_printf, 1, 2))); + PyAPI_FUNC(void) PySys_FormatStdout(const char *format, ...); + PyAPI_FUNC(void) PySys_FormatStderr(const char *format, ...); + diff --git a/mingw-w64-python3/PKGBUILD b/mingw-w64-python3/PKGBUILD index 0549bc6121..45b1c85231 100644 --- a/mingw-w64-python3/PKGBUILD +++ b/mingw-w64-python3/PKGBUILD @@ -6,7 +6,7 @@ _mingw_suff=mingw-w64-${CARCH} pkgname="${_mingw_suff}-${_realname}" _pybasever=3.3 pkgver=${_pybasever}.3 -pkgrel=9 +pkgrel=10 pkgdesc="A high-level scripting language (mingw-w64)" arch=('any') license=('PSF') @@ -101,7 +101,8 @@ source=("http://www.python.org/ftp/python/${pkgver%rc?}/Python-${pkgver}.tar.xz" 0810-remove_path_max.default.patch 0820-dont-link-with-gettext.patch 0830-ctypes-python-dll.patch - 0840-gdbm-module-includes.patch) + 0840-gdbm-module-includes.patch + 0850-use-gnu_printf-in-format.patch) prepare() { cd "${srcdir}/Python-${pkgver}" @@ -193,6 +194,7 @@ prepare() { patch -Np1 -i "${srcdir}"/0820-dont-link-with-gettext.patch patch -Np1 -i "${srcdir}"/0830-ctypes-python-dll.patch patch -Np1 -i "${srcdir}"/0840-gdbm-module-includes.patch + patch -Np1 -i "${srcdir}"/0850-use-gnu_printf-in-format.patch autoreconf -vfi @@ -388,4 +390,5 @@ md5sums=('4ca001c5586eb0744e3174bc75c6fba8' '419a6003f3960a86d53413f9ef71559a' '31e86876b58271bf0404ac3f28e3d662' '57976e9b0b37ad3835d7a3eedb53dc35' - '2f7891026edc9526b6b11ff1c918e638') + '2f7891026edc9526b6b11ff1c918e638' + 'f6eb51c7faa9e705d850d5900b3948fd')