diff options
author | Alexander Kanavin <alexander.kanavin@linux.intel.com> | 2017-03-27 16:19:55 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-03-28 08:43:13 +0100 |
commit | 8c1c392ca34da1c64336d0aa2d0a26b9c23d8d39 (patch) | |
tree | 37f509b2269d4a37cebcde905b84ec2e52c61d18 | |
parent | 3d29214b20433a506a3d59cdc08fc1a9be09a5a0 (diff) | |
download | poky-8c1c392ca34da1c64336d0aa2d0a26b9c23d8d39.tar.gz |
dnf: move the entire dnf/rpm4 stack to Python 3
[YOCTO #11180]
(From OE-Core rev: bedcdc4cf921b70a8cfb16c6684668d0ac9e1942)
Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
16 files changed, 621 insertions, 133 deletions
diff --git a/meta/classes/rootfs_rpm.bbclass b/meta/classes/rootfs_rpm.bbclass index af0f23877a..7f305f51ca 100644 --- a/meta/classes/rootfs_rpm.bbclass +++ b/meta/classes/rootfs_rpm.bbclass | |||
@@ -11,8 +11,8 @@ export STAGING_LIBDIR | |||
11 | # Add 100Meg of extra space for dnf | 11 | # Add 100Meg of extra space for dnf |
12 | IMAGE_ROOTFS_EXTRA_SPACE_append = "${@bb.utils.contains("PACKAGE_INSTALL", "dnf", " + 102400", "" ,d)}" | 12 | IMAGE_ROOTFS_EXTRA_SPACE_append = "${@bb.utils.contains("PACKAGE_INSTALL", "dnf", " + 102400", "" ,d)}" |
13 | 13 | ||
14 | # Dnf is python based, so be sure python-native is available to us. | 14 | # Dnf is python based, so be sure python3-native is available to us. |
15 | EXTRANATIVEPATH += "python-native" | 15 | EXTRANATIVEPATH += "python3-native" |
16 | 16 | ||
17 | # opkg is needed for update-alternatives | 17 | # opkg is needed for update-alternatives |
18 | RPMROOTFSDEPENDS = "rpm-native:do_populate_sysroot \ | 18 | RPMROOTFSDEPENDS = "rpm-native:do_populate_sysroot \ |
diff --git a/meta/conf/distro/include/security_flags.inc b/meta/conf/distro/include/security_flags.inc index 89fd45b859..6df184213e 100644 --- a/meta/conf/distro/include/security_flags.inc +++ b/meta/conf/distro/include/security_flags.inc | |||
@@ -72,12 +72,11 @@ SECURITY_CFLAGS_pn-openssl = "${SECURITY_NO_PIE_CFLAGS}" | |||
72 | SECURITY_CFLAGS_pn-opensp = "${SECURITY_NO_PIE_CFLAGS}" | 72 | SECURITY_CFLAGS_pn-opensp = "${SECURITY_NO_PIE_CFLAGS}" |
73 | SECURITY_CFLAGS_pn-ppp = "${SECURITY_NO_PIE_CFLAGS}" | 73 | SECURITY_CFLAGS_pn-ppp = "${SECURITY_NO_PIE_CFLAGS}" |
74 | SECURITY_CFLAGS_pn-python = "${SECURITY_NO_PIE_CFLAGS}" | 74 | SECURITY_CFLAGS_pn-python = "${SECURITY_NO_PIE_CFLAGS}" |
75 | SECURITY_CFLAGS_pn-python-backports-lzma = "${SECURITY_NO_PIE_CFLAGS}" | ||
76 | SECURITY_CFLAGS_pn-python-pycurl = "${SECURITY_NO_PIE_CFLAGS}" | 75 | SECURITY_CFLAGS_pn-python-pycurl = "${SECURITY_NO_PIE_CFLAGS}" |
77 | SECURITY_CFLAGS_pn-python-pygpgme = "${SECURITY_NO_PIE_CFLAGS}" | ||
78 | SECURITY_CFLAGS_pn-python-numpy = "${SECURITY_NO_PIE_CFLAGS}" | 76 | SECURITY_CFLAGS_pn-python-numpy = "${SECURITY_NO_PIE_CFLAGS}" |
79 | SECURITY_CFLAGS_pn-python3-numpy = "${SECURITY_NO_PIE_CFLAGS}" | 77 | SECURITY_CFLAGS_pn-python3-numpy = "${SECURITY_NO_PIE_CFLAGS}" |
80 | SECURITY_CFLAGS_pn-python3-pycairo = "${SECURITY_NO_PIE_CFLAGS}" | 78 | SECURITY_CFLAGS_pn-python3-pycairo = "${SECURITY_NO_PIE_CFLAGS}" |
79 | SECURITY_CFLAGS_pn-python3-pygpgme = "${SECURITY_NO_PIE_CFLAGS}" | ||
81 | SECURITY_CFLAGS_pn-python3 = "${SECURITY_NO_PIE_CFLAGS}" | 80 | SECURITY_CFLAGS_pn-python3 = "${SECURITY_NO_PIE_CFLAGS}" |
82 | SECURITY_CFLAGS_pn-syslinux = "${SECURITY_NO_PIE_CFLAGS}" | 81 | SECURITY_CFLAGS_pn-syslinux = "${SECURITY_NO_PIE_CFLAGS}" |
83 | SECURITY_CFLAGS_pn-slang = "${SECURITY_NO_PIE_CFLAGS}" | 82 | SECURITY_CFLAGS_pn-slang = "${SECURITY_NO_PIE_CFLAGS}" |
diff --git a/meta/recipes-devtools/createrepo-c/createrepo-c_git.bb b/meta/recipes-devtools/createrepo-c/createrepo-c_git.bb index 1e69067eeb..31761368b7 100644 --- a/meta/recipes-devtools/createrepo-c/createrepo-c_git.bb +++ b/meta/recipes-devtools/createrepo-c/createrepo-c_git.bb | |||
@@ -17,9 +17,9 @@ S = "${WORKDIR}/git" | |||
17 | DEPENDS = "expat curl glib-2.0 libxml2 openssl bzip2 zlib file sqlite3 xz rpm" | 17 | DEPENDS = "expat curl glib-2.0 libxml2 openssl bzip2 zlib file sqlite3 xz rpm" |
18 | DEPENDS_append_class-native = " file-replacement-native" | 18 | DEPENDS_append_class-native = " file-replacement-native" |
19 | 19 | ||
20 | inherit cmake pkgconfig bash-completion distutils-base | 20 | inherit cmake pkgconfig bash-completion distutils3-base |
21 | 21 | ||
22 | EXTRA_OECMAKE = " -DPYTHON_INSTALL_DIR=${PYTHON_SITEPACKAGES_DIR}" | 22 | EXTRA_OECMAKE = " -DPYTHON_INSTALL_DIR=${PYTHON_SITEPACKAGES_DIR} -DPYTHON_DESIRED=3" |
23 | 23 | ||
24 | BBCLASSEXTEND = "native" | 24 | BBCLASSEXTEND = "native" |
25 | 25 | ||
diff --git a/meta/recipes-devtools/dnf/dnf/0028-Use-backports.lzma-not-lzma.patch b/meta/recipes-devtools/dnf/dnf/0028-Use-backports.lzma-not-lzma.patch deleted file mode 100644 index 57038a8c7d..0000000000 --- a/meta/recipes-devtools/dnf/dnf/0028-Use-backports.lzma-not-lzma.patch +++ /dev/null | |||
@@ -1,30 +0,0 @@ | |||
1 | From 89af5c84d4b920d22ae882fcc5ab71ba09443cea Mon Sep 17 00:00:00 2001 | ||
2 | From: Alexander Kanavin <alex.kanavin@gmail.com> | ||
3 | Date: Fri, 30 Dec 2016 18:28:18 +0200 | ||
4 | Subject: [PATCH 28/30] Use backports.lzma, not lzma | ||
5 | |||
6 | This is needed when using Python 2.x and should be dropped | ||
7 | after moving to Python 3.x | ||
8 | |||
9 | Upstream-Status: Inappropriate [oe-core specific] | ||
10 | Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> | ||
11 | --- | ||
12 | dnf/yum/misc.py | 2 +- | ||
13 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
14 | |||
15 | diff --git a/dnf/yum/misc.py b/dnf/yum/misc.py | ||
16 | index 441b0148..6b4aea0a 100644 | ||
17 | --- a/dnf/yum/misc.py | ||
18 | +++ b/dnf/yum/misc.py | ||
19 | @@ -37,7 +37,7 @@ import gpgme.editutil | ||
20 | import gzip | ||
21 | import hashlib | ||
22 | import io | ||
23 | -import lzma | ||
24 | +import backports.lzma | ||
25 | import os | ||
26 | import os.path | ||
27 | import pwd | ||
28 | -- | ||
29 | 2.11.0 | ||
30 | |||
diff --git a/meta/recipes-devtools/dnf/dnf/0030-Run-python-scripts-using-env.patch b/meta/recipes-devtools/dnf/dnf/0030-Run-python-scripts-using-env.patch index 7fc8afef53..61328e6ec5 100644 --- a/meta/recipes-devtools/dnf/dnf/0030-Run-python-scripts-using-env.patch +++ b/meta/recipes-devtools/dnf/dnf/0030-Run-python-scripts-using-env.patch | |||
@@ -19,7 +19,7 @@ index 5b06aa26..9f6f703e 100755 | |||
19 | +++ b/bin/dnf-automatic.in | 19 | +++ b/bin/dnf-automatic.in |
20 | @@ -1,4 +1,4 @@ | 20 | @@ -1,4 +1,4 @@ |
21 | -#!@PYTHON_EXECUTABLE@ | 21 | -#!@PYTHON_EXECUTABLE@ |
22 | +#!/usr/bin/env python | 22 | +#!/usr/bin/env python3 |
23 | # dnf-automatic executable. | 23 | # dnf-automatic executable. |
24 | # | 24 | # |
25 | # Copyright (C) 2014-2016 Red Hat, Inc. | 25 | # Copyright (C) 2014-2016 Red Hat, Inc. |
@@ -29,7 +29,7 @@ index 645d0f06..ab141abd 100755 | |||
29 | +++ b/bin/dnf.in | 29 | +++ b/bin/dnf.in |
30 | @@ -1,4 +1,4 @@ | 30 | @@ -1,4 +1,4 @@ |
31 | -#!@PYTHON_EXECUTABLE@ | 31 | -#!@PYTHON_EXECUTABLE@ |
32 | +#!/usr/bin/env python | 32 | +#!/usr/bin/env python3 |
33 | # The dnf executable script. | 33 | # The dnf executable script. |
34 | # | 34 | # |
35 | # Copyright (C) 2012-2016 Red Hat, Inc. | 35 | # Copyright (C) 2012-2016 Red Hat, Inc. |
@@ -39,7 +39,7 @@ index f1fee071..013dc8c5 100755 | |||
39 | +++ b/bin/yum.in | 39 | +++ b/bin/yum.in |
40 | @@ -1,4 +1,4 @@ | 40 | @@ -1,4 +1,4 @@ |
41 | -#!@PYTHON_EXECUTABLE@ | 41 | -#!@PYTHON_EXECUTABLE@ |
42 | +#!/usr/bin/env python | 42 | +#!/usr/bin/env python3 |
43 | # The dnf executable script. | 43 | # The dnf executable script. |
44 | # | 44 | # |
45 | # Copyright (C) 2016 Red Hat, Inc. | 45 | # Copyright (C) 2016 Red Hat, Inc. |
diff --git a/meta/recipes-devtools/dnf/dnf_git.bb b/meta/recipes-devtools/dnf/dnf_git.bb index 3a2cb635e4..7d7f597e5a 100644 --- a/meta/recipes-devtools/dnf/dnf_git.bb +++ b/meta/recipes-devtools/dnf/dnf_git.bb | |||
@@ -5,7 +5,6 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ | |||
5 | " | 5 | " |
6 | 6 | ||
7 | SRC_URI = "git://github.com/rpm-software-management/dnf.git \ | 7 | SRC_URI = "git://github.com/rpm-software-management/dnf.git \ |
8 | file://0028-Use-backports.lzma-not-lzma.patch \ | ||
9 | file://0029-Do-not-set-PYTHON_INSTALL_DIR-by-running-python.patch \ | 8 | file://0029-Do-not-set-PYTHON_INSTALL_DIR-by-running-python.patch \ |
10 | file://0030-Run-python-scripts-using-env.patch \ | 9 | file://0030-Run-python-scripts-using-env.patch \ |
11 | file://0001-Do-not-prepend-installroot-to-logdir.patch \ | 10 | file://0001-Do-not-prepend-installroot-to-logdir.patch \ |
@@ -18,24 +17,22 @@ SRCREV = "f0093d672d3069cfee8447973ae70ef615fd8886" | |||
18 | 17 | ||
19 | S = "${WORKDIR}/git" | 18 | S = "${WORKDIR}/git" |
20 | 19 | ||
21 | inherit cmake gettext bash-completion distutils-base systemd | 20 | inherit cmake gettext bash-completion distutils3-base systemd |
22 | 21 | ||
23 | DEPENDS += "libdnf librepo libcomps python-pygpgme python-iniparse" | 22 | DEPENDS += "libdnf librepo libcomps python3-pygpgme python3-iniparse" |
24 | # python 2.x only, drop when moving to python 3.x | ||
25 | DEPENDS += "python-backports-lzma" | ||
26 | 23 | ||
27 | # manpages generation requires http://www.sphinx-doc.org/ | 24 | # manpages generation requires http://www.sphinx-doc.org/ |
28 | EXTRA_OECMAKE = " -DWITH_MAN=0 -DPYTHON_INSTALL_DIR=${PYTHON_SITEPACKAGES_DIR}" | 25 | EXTRA_OECMAKE = " -DWITH_MAN=0 -DPYTHON_INSTALL_DIR=${PYTHON_SITEPACKAGES_DIR} -DPYTHON_DESIRED=3" |
29 | 26 | ||
30 | BBCLASSEXTEND = "native nativesdk" | 27 | BBCLASSEXTEND = "native nativesdk" |
31 | RDEPENDS_${PN}_class-target += "python-core python-codecs python-netclient python-email python-threading python-distutils librepo python-shell python-subprocess libcomps libdnf python-sqlite3 python-compression python-pygpgme python-backports-lzma python-rpm python-iniparse python-json python-importlib python-curses python-argparse" | 28 | RDEPENDS_${PN}_class-target += "python3-core python3-codecs python3-netclient python3-email python3-threading python3-distutils librepo python3-shell python3-subprocess libcomps libdnf python3-sqlite3 python3-compression python3-pygpgme python3-rpm python3-iniparse python3-json python3-importlib python3-curses python3-argparse python3-misc" |
32 | 29 | ||
33 | # Create a symlink called 'dnf' as 'make install' does not do it, but | 30 | # Create a symlink called 'dnf' as 'make install' does not do it, but |
34 | # .spec file in dnf source tree does (and then Fedora and dnf documentation | 31 | # .spec file in dnf source tree does (and then Fedora and dnf documentation |
35 | # says that dnf binary is plain 'dnf'). | 32 | # says that dnf binary is plain 'dnf'). |
36 | do_install_append() { | 33 | do_install_append() { |
37 | ln -s -r ${D}/${bindir}/dnf-2 ${D}/${bindir}/dnf | 34 | ln -s -r ${D}/${bindir}/dnf-3 ${D}/${bindir}/dnf |
38 | ln -s -r ${D}/${bindir}/dnf-automatic-2 ${D}/${bindir}/dnf-automatic | 35 | ln -s -r ${D}/${bindir}/dnf-automatic-3 ${D}/${bindir}/dnf-automatic |
39 | } | 36 | } |
40 | 37 | ||
41 | # Direct dnf-native to read rpm configuration from our sysroot, not the one it was compiled in | 38 | # Direct dnf-native to read rpm configuration from our sysroot, not the one it was compiled in |
diff --git a/meta/recipes-devtools/libcomps/libcomps_git.bb b/meta/recipes-devtools/libcomps/libcomps_git.bb index db4481bc8c..e69bf67729 100644 --- a/meta/recipes-devtools/libcomps/libcomps_git.bb +++ b/meta/recipes-devtools/libcomps/libcomps_git.bb | |||
@@ -13,11 +13,11 @@ SRCREV = "01a4759894cccff64d2561614a58281adf5ce859" | |||
13 | 13 | ||
14 | S = "${WORKDIR}/git" | 14 | S = "${WORKDIR}/git" |
15 | 15 | ||
16 | inherit cmake distutils-base | 16 | inherit cmake distutils3-base |
17 | 17 | ||
18 | DEPENDS = "libxml2 expat libcheck" | 18 | DEPENDS += "libxml2 expat libcheck" |
19 | 19 | ||
20 | EXTRA_OECMAKE = " -DPYTHON_INSTALL_DIR=${PYTHON_SITEPACKAGES_DIR}" | 20 | EXTRA_OECMAKE = " -DPYTHON_INSTALL_DIR=${PYTHON_SITEPACKAGES_DIR} -DPYTHON_DESIRED=3" |
21 | OECMAKE_SOURCEPATH = "${S}/libcomps" | 21 | OECMAKE_SOURCEPATH = "${S}/libcomps" |
22 | 22 | ||
23 | BBCLASSEXTEND = "native nativesdk" | 23 | BBCLASSEXTEND = "native nativesdk" |
diff --git a/meta/recipes-devtools/libdnf/libdnf_git.bb b/meta/recipes-devtools/libdnf/libdnf_git.bb index 6e9cfcc862..ef28611f8a 100644 --- a/meta/recipes-devtools/libdnf/libdnf_git.bb +++ b/meta/recipes-devtools/libdnf/libdnf_git.bb | |||
@@ -17,20 +17,9 @@ S = "${WORKDIR}/git" | |||
17 | 17 | ||
18 | DEPENDS = "glib-2.0 libsolv libcheck librepo rpm gtk-doc" | 18 | DEPENDS = "glib-2.0 libsolv libcheck librepo rpm gtk-doc" |
19 | 19 | ||
20 | inherit gtk-doc gobject-introspection cmake pkgconfig | 20 | inherit gtk-doc gobject-introspection cmake pkgconfig distutils3-base |
21 | 21 | ||
22 | # We cannot inherit pythonnative (or descendant classes like distutils etc.) | 22 | EXTRA_OECMAKE = " -DPYTHON_INSTALL_DIR=${PYTHON_SITEPACKAGES_DIR} -DWITH_MAN=OFF -DPYTHON_DESIRED=3 \ |
23 | # because that would conflict with inheriting python3native | ||
24 | # (which is done by inheriting gobject-introspection). | ||
25 | # But libdnf only needs the path to native Python 2.x binary | ||
26 | # so we simply set it explicitly here. | ||
27 | # | ||
28 | # These lines can be dropped when dnf stack is moved to python 3.x | ||
29 | EXTRANATIVEPATH += "python-native" | ||
30 | FILES_${PN} += " ${libdir}/python2.7/*" | ||
31 | DEPENDS += "python-native" | ||
32 | |||
33 | EXTRA_OECMAKE = " -DPYTHON_INSTALL_DIR=${PYTHON_SITEPACKAGES_DIR} -DWITH_MAN=OFF \ | ||
34 | ${@bb.utils.contains('GI_DATA_ENABLED', 'True', '-DWITH_GIR=ON', '-DWITH_GIR=OFF', d)} \ | 23 | ${@bb.utils.contains('GI_DATA_ENABLED', 'True', '-DWITH_GIR=ON', '-DWITH_GIR=OFF', d)} \ |
35 | " | 24 | " |
36 | EXTRA_OECMAKE_append_class-native = " -DWITH_GIR=OFF" | 25 | EXTRA_OECMAKE_append_class-native = " -DWITH_GIR=OFF" |
diff --git a/meta/recipes-devtools/librepo/librepo_git.bb b/meta/recipes-devtools/librepo/librepo_git.bb index 3f3c5fbcf5..2f194f1439 100644 --- a/meta/recipes-devtools/librepo/librepo_git.bb +++ b/meta/recipes-devtools/librepo/librepo_git.bb | |||
@@ -16,9 +16,9 @@ S = "${WORKDIR}/git" | |||
16 | 16 | ||
17 | DEPENDS = "curl expat glib-2.0 openssl attr libcheck gpgme" | 17 | DEPENDS = "curl expat glib-2.0 openssl attr libcheck gpgme" |
18 | 18 | ||
19 | inherit cmake distutils-base pkgconfig | 19 | inherit cmake distutils3-base pkgconfig |
20 | 20 | ||
21 | EXTRA_OECMAKE = " -DPYTHON_INSTALL_DIR=${PYTHON_SITEPACKAGES_DIR}" | 21 | EXTRA_OECMAKE = " -DPYTHON_INSTALL_DIR=${PYTHON_SITEPACKAGES_DIR} -DPYTHON_DESIRED=3" |
22 | 22 | ||
23 | BBCLASSEXTEND = "native nativesdk" | 23 | BBCLASSEXTEND = "native nativesdk" |
24 | 24 | ||
diff --git a/meta/recipes-devtools/python-backports-lzma/python-backports-lzma/0001-setup.py-do-not-add-include-and-library-directories-.patch b/meta/recipes-devtools/python-backports-lzma/python-backports-lzma/0001-setup.py-do-not-add-include-and-library-directories-.patch deleted file mode 100644 index 0eb904a8a7..0000000000 --- a/meta/recipes-devtools/python-backports-lzma/python-backports-lzma/0001-setup.py-do-not-add-include-and-library-directories-.patch +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | From e5e3196cf69172b625c8c6ccca991c02fd18137c Mon Sep 17 00:00:00 2001 | ||
2 | From: Alexander Kanavin <alex.kanavin@gmail.com> | ||
3 | Date: Fri, 30 Dec 2016 18:02:12 +0200 | ||
4 | Subject: [PATCH] setup.py: do not add include and library directories from the | ||
5 | host | ||
6 | |||
7 | This avoids host contamination. | ||
8 | |||
9 | Upstream-Status: Inappropriate [oe-core specific] | ||
10 | Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> | ||
11 | --- | ||
12 | setup.py | 4 +--- | ||
13 | 1 file changed, 1 insertion(+), 3 deletions(-) | ||
14 | |||
15 | diff --git a/setup.py b/setup.py | ||
16 | index 7886cf7..9a0356a 100644 | ||
17 | --- a/setup.py | ||
18 | +++ b/setup.py | ||
19 | @@ -31,9 +31,7 @@ packages = ["backports", "backports.lzma"] | ||
20 | home = os.path.expanduser("~") | ||
21 | extens = [Extension('backports/lzma/_lzma', | ||
22 | ['backports/lzma/_lzmamodule.c'], | ||
23 | - libraries = ['lzma'], | ||
24 | - include_dirs = [os.path.join(home, 'include'), '/opt/local/include', '/usr/local/include'], | ||
25 | - library_dirs = [os.path.join(home, 'lib'), '/opt/local/lib', '/usr/local/lib'] | ||
26 | + libraries = ['lzma'] | ||
27 | )] | ||
28 | |||
29 | descr = "Backport of Python 3.3's 'lzma' module for XZ/LZMA compressed files." | ||
30 | -- | ||
31 | 2.11.0 | ||
32 | |||
diff --git a/meta/recipes-devtools/python-backports-lzma/python-backports-lzma_git.bb b/meta/recipes-devtools/python-backports-lzma/python-backports-lzma_git.bb deleted file mode 100644 index 93c6684be6..0000000000 --- a/meta/recipes-devtools/python-backports-lzma/python-backports-lzma_git.bb +++ /dev/null | |||
@@ -1,21 +0,0 @@ | |||
1 | HOMEPAGE = "https://github.com/peterjc/backports.lzma" | ||
2 | LICENSE = "BSD" | ||
3 | LIC_FILES_CHKSUM = "file://LICENSE;md5=846e05e7e9e1c886b2637c230cfcd5dd" | ||
4 | |||
5 | SRC_URI = "git://github.com/peterjc/backports.lzma.git \ | ||
6 | file://0001-setup.py-do-not-add-include-and-library-directories-.patch \ | ||
7 | " | ||
8 | |||
9 | PV = "0.0.6+git${SRCPV}" | ||
10 | SRCREV = "718b3316ae7aee8e03c02e7e110108779ce3aec8" | ||
11 | |||
12 | S = "${WORKDIR}/git" | ||
13 | |||
14 | inherit distutils | ||
15 | |||
16 | DEPENDS_append = " xz" | ||
17 | |||
18 | RDEPENDS_${PN} += "python-core python-io python-pkgutil" | ||
19 | RDEPENDS_${PN}_class-native += "python-core" | ||
20 | |||
21 | BBCLASSEXTEND = "native nativesdk" | ||
diff --git a/meta/recipes-devtools/python/python3-iniparse/0001-Add-python-3-compatibility.patch b/meta/recipes-devtools/python/python3-iniparse/0001-Add-python-3-compatibility.patch new file mode 100644 index 0000000000..44090a20d0 --- /dev/null +++ b/meta/recipes-devtools/python/python3-iniparse/0001-Add-python-3-compatibility.patch | |||
@@ -0,0 +1,552 @@ | |||
1 | From 8a98e4d44a5e59439a4b6bd95368cc362412c995 Mon Sep 17 00:00:00 2001 | ||
2 | From: Alexander Kanavin <alex.kanavin@gmail.com> | ||
3 | Date: Fri, 24 Mar 2017 18:06:08 +0200 | ||
4 | Subject: [PATCH] Add python 3 compatibility. | ||
5 | |||
6 | Taken from | ||
7 | http://pkgs.fedoraproject.org/cgit/rpms/python-iniparse.git/tree/python-iniparse-python3-compat.patch | ||
8 | |||
9 | Upstream-Status: Inappropriate [upstream is defunct] | ||
10 | Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> | ||
11 | --- | ||
12 | iniparse/__init__.py | 20 ++++++++++---------- | ||
13 | iniparse/compat.py | 30 ++++++++++++++++-------------- | ||
14 | iniparse/config.py | 16 ++++++++-------- | ||
15 | iniparse/configparser.py | 7 +++++++ | ||
16 | iniparse/ini.py | 20 ++++++++++++-------- | ||
17 | iniparse/utils.py | 4 ++-- | ||
18 | tests/__init__.py | 14 +++++++------- | ||
19 | tests/test_compat.py | 23 +++++++++++++++-------- | ||
20 | tests/test_fuzz.py | 18 +++++++++--------- | ||
21 | tests/test_ini.py | 8 ++++---- | ||
22 | tests/test_misc.py | 4 ++-- | ||
23 | tests/test_tidy.py | 2 +- | ||
24 | tests/test_unicode.py | 10 +++++----- | ||
25 | 13 files changed, 98 insertions(+), 78 deletions(-) | ||
26 | create mode 100644 iniparse/configparser.py | ||
27 | |||
28 | diff --git a/iniparse/__init__.py b/iniparse/__init__.py | ||
29 | index 8de756f..7193f92 100644 | ||
30 | --- a/iniparse/__init__.py | ||
31 | +++ b/iniparse/__init__.py | ||
32 | @@ -3,17 +3,17 @@ | ||
33 | # Copyright (c) 2007 Tim Lauridsen <tla@rasmil.dk> | ||
34 | # All Rights Reserved. See LICENSE-PSF & LICENSE for details. | ||
35 | |||
36 | -from ini import INIConfig, change_comment_syntax | ||
37 | -from config import BasicConfig, ConfigNamespace | ||
38 | -from compat import RawConfigParser, ConfigParser, SafeConfigParser | ||
39 | -from utils import tidy | ||
40 | +from .ini import INIConfig, change_comment_syntax | ||
41 | +from .config import BasicConfig, ConfigNamespace | ||
42 | +from .compat import RawConfigParser, ConfigParser, SafeConfigParser | ||
43 | +from .utils import tidy | ||
44 | |||
45 | -from ConfigParser import DuplicateSectionError, \ | ||
46 | - NoSectionError, NoOptionError, \ | ||
47 | - InterpolationMissingOptionError, \ | ||
48 | - InterpolationDepthError, \ | ||
49 | - InterpolationSyntaxError, \ | ||
50 | - DEFAULTSECT, MAX_INTERPOLATION_DEPTH | ||
51 | +from .configparser import DuplicateSectionError, \ | ||
52 | + NoSectionError, NoOptionError, \ | ||
53 | + InterpolationMissingOptionError, \ | ||
54 | + InterpolationDepthError, \ | ||
55 | + InterpolationSyntaxError, \ | ||
56 | + DEFAULTSECT, MAX_INTERPOLATION_DEPTH | ||
57 | |||
58 | __all__ = [ | ||
59 | 'BasicConfig', 'ConfigNamespace', | ||
60 | diff --git a/iniparse/compat.py b/iniparse/compat.py | ||
61 | index db89ed8..f95c25c 100644 | ||
62 | --- a/iniparse/compat.py | ||
63 | +++ b/iniparse/compat.py | ||
64 | @@ -12,19 +12,21 @@ The underlying INIConfig object can be accessed as cfg.data | ||
65 | """ | ||
66 | |||
67 | import re | ||
68 | -from ConfigParser import DuplicateSectionError, \ | ||
69 | - NoSectionError, NoOptionError, \ | ||
70 | - InterpolationMissingOptionError, \ | ||
71 | - InterpolationDepthError, \ | ||
72 | - InterpolationSyntaxError, \ | ||
73 | - DEFAULTSECT, MAX_INTERPOLATION_DEPTH | ||
74 | +from .configparser import DuplicateSectionError, \ | ||
75 | + NoSectionError, NoOptionError, \ | ||
76 | + InterpolationMissingOptionError, \ | ||
77 | + InterpolationDepthError, \ | ||
78 | + InterpolationSyntaxError, \ | ||
79 | + DEFAULTSECT, MAX_INTERPOLATION_DEPTH | ||
80 | |||
81 | # These are imported only for compatiability. | ||
82 | # The code below does not reference them directly. | ||
83 | -from ConfigParser import Error, InterpolationError, \ | ||
84 | - MissingSectionHeaderError, ParsingError | ||
85 | +from .configparser import Error, InterpolationError, \ | ||
86 | + MissingSectionHeaderError, ParsingError | ||
87 | |||
88 | -import ini | ||
89 | +import six | ||
90 | + | ||
91 | +from . import ini | ||
92 | |||
93 | class RawConfigParser(object): | ||
94 | def __init__(self, defaults=None, dict_type=dict): | ||
95 | @@ -56,7 +58,7 @@ class RawConfigParser(object): | ||
96 | # The default section is the only one that gets the case-insensitive | ||
97 | # treatment - so it is special-cased here. | ||
98 | if section.lower() == "default": | ||
99 | - raise ValueError, 'Invalid section name: %s' % section | ||
100 | + raise ValueError('Invalid section name: %s' % section) | ||
101 | |||
102 | if self.has_section(section): | ||
103 | raise DuplicateSectionError(section) | ||
104 | @@ -88,7 +90,7 @@ class RawConfigParser(object): | ||
105 | filename may also be given. | ||
106 | """ | ||
107 | files_read = [] | ||
108 | - if isinstance(filenames, basestring): | ||
109 | + if isinstance(filenames, six.string_types): | ||
110 | filenames = [filenames] | ||
111 | for filename in filenames: | ||
112 | try: | ||
113 | @@ -143,7 +145,7 @@ class RawConfigParser(object): | ||
114 | def getboolean(self, section, option): | ||
115 | v = self.get(section, option) | ||
116 | if v.lower() not in self._boolean_states: | ||
117 | - raise ValueError, 'Not a boolean: %s' % v | ||
118 | + raise ValueError('Not a boolean: %s' % v) | ||
119 | return self._boolean_states[v.lower()] | ||
120 | |||
121 | def has_option(self, section, option): | ||
122 | @@ -234,7 +236,7 @@ class ConfigParser(RawConfigParser): | ||
123 | if "%(" in value: | ||
124 | try: | ||
125 | value = value % vars | ||
126 | - except KeyError, e: | ||
127 | + except KeyError as e: | ||
128 | raise InterpolationMissingOptionError( | ||
129 | option, section, rawval, e.args[0]) | ||
130 | else: | ||
131 | @@ -283,7 +285,7 @@ class SafeConfigParser(ConfigParser): | ||
132 | _badpercent_re = re.compile(r"%[^%]|%$") | ||
133 | |||
134 | def set(self, section, option, value): | ||
135 | - if not isinstance(value, basestring): | ||
136 | + if not isinstance(value, six.string_types): | ||
137 | raise TypeError("option values must be strings") | ||
138 | # check for bad percent signs: | ||
139 | # first, replace all "good" interpolations | ||
140 | diff --git a/iniparse/config.py b/iniparse/config.py | ||
141 | index 5cfa2ea..3b28549 100644 | ||
142 | --- a/iniparse/config.py | ||
143 | +++ b/iniparse/config.py | ||
144 | @@ -143,7 +143,7 @@ class BasicConfig(ConfigNamespace): | ||
145 | |||
146 | >>> n.aaa = 42 | ||
147 | >>> del n.x | ||
148 | - >>> print n | ||
149 | + >>> print(n) | ||
150 | aaa = 42 | ||
151 | name.first = paramjit | ||
152 | name.last = oberoi | ||
153 | @@ -152,7 +152,7 @@ class BasicConfig(ConfigNamespace): | ||
154 | |||
155 | >>> isinstance(n.name, ConfigNamespace) | ||
156 | True | ||
157 | - >>> print n.name | ||
158 | + >>> print(n.name) | ||
159 | first = paramjit | ||
160 | last = oberoi | ||
161 | >>> sorted(list(n.name)) | ||
162 | @@ -160,7 +160,7 @@ class BasicConfig(ConfigNamespace): | ||
163 | |||
164 | Finally, values can be read from a file as follows: | ||
165 | |||
166 | - >>> from StringIO import StringIO | ||
167 | + >>> from six import StringIO | ||
168 | >>> sio = StringIO(''' | ||
169 | ... # comment | ||
170 | ... ui.height = 100 | ||
171 | @@ -171,7 +171,7 @@ class BasicConfig(ConfigNamespace): | ||
172 | ... ''') | ||
173 | >>> n = BasicConfig() | ||
174 | >>> n._readfp(sio) | ||
175 | - >>> print n | ||
176 | + >>> print(n) | ||
177 | complexity = medium | ||
178 | data.secret.password = goodness=gracious me | ||
179 | have_python | ||
180 | @@ -199,7 +199,7 @@ class BasicConfig(ConfigNamespace): | ||
181 | |||
182 | def __str__(self, prefix=''): | ||
183 | lines = [] | ||
184 | - keys = self._data.keys() | ||
185 | + keys = list(self._data.keys()) | ||
186 | keys.sort() | ||
187 | for name in keys: | ||
188 | value = self._data[name] | ||
189 | @@ -258,7 +258,7 @@ def update_config(target, source): | ||
190 | >>> n.ui.display_clock = True | ||
191 | >>> n.ui.display_qlength = True | ||
192 | >>> n.ui.width = 150 | ||
193 | - >>> print n | ||
194 | + >>> print(n) | ||
195 | playlist.expand_playlist = True | ||
196 | ui.display_clock = True | ||
197 | ui.display_qlength = True | ||
198 | @@ -267,7 +267,7 @@ def update_config(target, source): | ||
199 | >>> from iniparse import ini | ||
200 | >>> i = ini.INIConfig() | ||
201 | >>> update_config(i, n) | ||
202 | - >>> print i | ||
203 | + >>> print(i) | ||
204 | [playlist] | ||
205 | expand_playlist = True | ||
206 | <BLANKLINE> | ||
207 | @@ -277,7 +277,7 @@ def update_config(target, source): | ||
208 | width = 150 | ||
209 | |||
210 | """ | ||
211 | - for name in source: | ||
212 | + for name in sorted(source): | ||
213 | value = source[name] | ||
214 | if isinstance(value, ConfigNamespace): | ||
215 | if name in target: | ||
216 | diff --git a/iniparse/configparser.py b/iniparse/configparser.py | ||
217 | new file mode 100644 | ||
218 | index 0000000..c543d50 | ||
219 | --- /dev/null | ||
220 | +++ b/iniparse/configparser.py | ||
221 | @@ -0,0 +1,7 @@ | ||
222 | +try: | ||
223 | + from ConfigParser import * | ||
224 | + # not all objects get imported with __all__ | ||
225 | + from ConfigParser import Error, InterpolationMissingOptionError | ||
226 | +except ImportError: | ||
227 | + from configparser import * | ||
228 | + from configparser import Error, InterpolationMissingOptionError | ||
229 | diff --git a/iniparse/ini.py b/iniparse/ini.py | ||
230 | index 408354d..052d9e9 100644 | ||
231 | --- a/iniparse/ini.py | ||
232 | +++ b/iniparse/ini.py | ||
233 | @@ -7,7 +7,7 @@ | ||
234 | |||
235 | Example: | ||
236 | |||
237 | - >>> from StringIO import StringIO | ||
238 | + >>> from six import StringIO | ||
239 | >>> sio = StringIO('''# configure foo-application | ||
240 | ... [foo] | ||
241 | ... bar1 = qualia | ||
242 | @@ -16,14 +16,14 @@ Example: | ||
243 | ... special = 1''') | ||
244 | |||
245 | >>> cfg = INIConfig(sio) | ||
246 | - >>> print cfg.foo.bar1 | ||
247 | + >>> print(cfg.foo.bar1) | ||
248 | qualia | ||
249 | - >>> print cfg['foo-ext'].special | ||
250 | + >>> print(cfg['foo-ext'].special) | ||
251 | 1 | ||
252 | >>> cfg.foo.newopt = 'hi!' | ||
253 | >>> cfg.baz.enabled = 0 | ||
254 | |||
255 | - >>> print cfg | ||
256 | + >>> print(cfg) | ||
257 | # configure foo-application | ||
258 | [foo] | ||
259 | bar1 = qualia | ||
260 | @@ -42,9 +42,11 @@ Example: | ||
261 | # Backward-compatiable with ConfigParser | ||
262 | |||
263 | import re | ||
264 | -from ConfigParser import DEFAULTSECT, ParsingError, MissingSectionHeaderError | ||
265 | +from .configparser import DEFAULTSECT, ParsingError, MissingSectionHeaderError | ||
266 | |||
267 | -import config | ||
268 | +import six | ||
269 | + | ||
270 | +from . import config | ||
271 | |||
272 | class LineType(object): | ||
273 | line = None | ||
274 | @@ -278,6 +280,8 @@ class LineContainer(object): | ||
275 | value = property(get_value, set_value) | ||
276 | |||
277 | def __str__(self): | ||
278 | + for c in self.contents: | ||
279 | + pass#print(c.__str__()) | ||
280 | s = [x.__str__() for x in self.contents] | ||
281 | return '\n'.join(s) | ||
282 | |||
283 | @@ -465,7 +469,7 @@ class INIConfig(config.ConfigNamespace): | ||
284 | self._sections = {} | ||
285 | if defaults is None: defaults = {} | ||
286 | self._defaults = INISection(LineContainer(), optionxformsource=self) | ||
287 | - for name, value in defaults.iteritems(): | ||
288 | + for name, value in defaults.items(): | ||
289 | self._defaults[name] = value | ||
290 | if fp is not None: | ||
291 | self._readfp(fp) | ||
292 | @@ -551,7 +555,7 @@ class INIConfig(config.ConfigNamespace): | ||
293 | |||
294 | for line in readline_iterator(fp): | ||
295 | # Check for BOM on first line | ||
296 | - if linecount == 0 and isinstance(line, unicode): | ||
297 | + if linecount == 0 and isinstance(line, six.text_type): | ||
298 | if line[0] == u'\ufeff': | ||
299 | line = line[1:] | ||
300 | self._bom = True | ||
301 | diff --git a/iniparse/utils.py b/iniparse/utils.py | ||
302 | index 829fc28..f8b773a 100644 | ||
303 | --- a/iniparse/utils.py | ||
304 | +++ b/iniparse/utils.py | ||
305 | @@ -1,5 +1,5 @@ | ||
306 | -import compat | ||
307 | -from ini import LineContainer, EmptyLine | ||
308 | +from . import compat | ||
309 | +from .ini import LineContainer, EmptyLine | ||
310 | |||
311 | def tidy(cfg): | ||
312 | """Clean up blank lines. | ||
313 | diff --git a/tests/__init__.py b/tests/__init__.py | ||
314 | index f1fa321..88689fb 100644 | ||
315 | --- a/tests/__init__.py | ||
316 | +++ b/tests/__init__.py | ||
317 | @@ -1,12 +1,12 @@ | ||
318 | import unittest, doctest | ||
319 | |||
320 | -import test_ini | ||
321 | -import test_misc | ||
322 | -import test_fuzz | ||
323 | -import test_compat | ||
324 | -import test_unicode | ||
325 | -import test_tidy | ||
326 | -import test_multiprocessing | ||
327 | +from . import test_ini | ||
328 | +from . import test_misc | ||
329 | +from . import test_fuzz | ||
330 | +from . import test_compat | ||
331 | +from . import test_unicode | ||
332 | +from . import test_tidy | ||
333 | +from . import test_multiprocessing | ||
334 | from iniparse import config | ||
335 | from iniparse import ini | ||
336 | |||
337 | diff --git a/tests/test_compat.py b/tests/test_compat.py | ||
338 | index b8da3d5..b6dfb5c 100644 | ||
339 | --- a/tests/test_compat.py | ||
340 | +++ b/tests/test_compat.py | ||
341 | @@ -1,9 +1,16 @@ | ||
342 | from iniparse import compat as ConfigParser | ||
343 | -import StringIO | ||
344 | +from six import StringIO | ||
345 | +try: | ||
346 | + import UserDict | ||
347 | +except ImportError: | ||
348 | + import collections as UserDict | ||
349 | import unittest | ||
350 | -import UserDict | ||
351 | |||
352 | -from test import test_support | ||
353 | +import sys | ||
354 | +if sys.version_info[0] < 3: | ||
355 | + from test import test_support | ||
356 | +else: | ||
357 | + from test import support as test_support | ||
358 | |||
359 | class SortedDict(UserDict.UserDict): | ||
360 | def items(self): | ||
361 | @@ -35,7 +42,7 @@ class TestCaseBase(unittest.TestCase): | ||
362 | |||
363 | def fromstring(self, string, defaults=None): | ||
364 | cf = self.newconfig(defaults) | ||
365 | - sio = StringIO.StringIO(string) | ||
366 | + sio = StringIO(string) | ||
367 | cf.readfp(sio) | ||
368 | return cf | ||
369 | |||
370 | @@ -161,7 +168,7 @@ class TestCaseBase(unittest.TestCase): | ||
371 | "No Section!\n") | ||
372 | |||
373 | def parse_error(self, exc, src): | ||
374 | - sio = StringIO.StringIO(src) | ||
375 | + sio = StringIO(src) | ||
376 | self.assertRaises(exc, self.cf.readfp, sio) | ||
377 | |||
378 | def test_query_errors(self): | ||
379 | @@ -181,7 +188,7 @@ class TestCaseBase(unittest.TestCase): | ||
380 | def get_error(self, exc, section, option): | ||
381 | try: | ||
382 | self.cf.get(section, option) | ||
383 | - except exc, e: | ||
384 | + except exc as e: | ||
385 | return e | ||
386 | else: | ||
387 | self.fail("expected exception type %s.%s" | ||
388 | @@ -227,7 +234,7 @@ class TestCaseBase(unittest.TestCase): | ||
389 | "foo: another very\n" | ||
390 | " long line" | ||
391 | ) | ||
392 | - output = StringIO.StringIO() | ||
393 | + output = StringIO() | ||
394 | cf.write(output) | ||
395 | self.assertEqual( | ||
396 | output.getvalue(), | ||
397 | @@ -465,7 +472,7 @@ class SortedTestCase(RawConfigParserTestCase): | ||
398 | "o1=4\n" | ||
399 | "[a]\n" | ||
400 | "k=v\n") | ||
401 | - output = StringIO.StringIO() | ||
402 | + output = StringIO() | ||
403 | self.cf.write(output) | ||
404 | self.assertEquals(output.getvalue(), | ||
405 | "[a]\n" | ||
406 | diff --git a/tests/test_fuzz.py b/tests/test_fuzz.py | ||
407 | index 5420dcc..b219500 100644 | ||
408 | --- a/tests/test_fuzz.py | ||
409 | +++ b/tests/test_fuzz.py | ||
410 | @@ -1,9 +1,10 @@ | ||
411 | import re | ||
412 | import os | ||
413 | import random | ||
414 | +import sys | ||
415 | import unittest | ||
416 | -import ConfigParser | ||
417 | -from StringIO import StringIO | ||
418 | +from six import StringIO | ||
419 | +from six.moves import configparser | ||
420 | from iniparse import compat, ini, tidy | ||
421 | |||
422 | # TODO: | ||
423 | @@ -96,24 +97,25 @@ class test_fuzz(unittest.TestCase): | ||
424 | s = '\n'.join(good_lines) | ||
425 | cc = compat.RawConfigParser() | ||
426 | cc.readfp(StringIO(s)) | ||
427 | - cc_py = ConfigParser.RawConfigParser() | ||
428 | + cc_py = configparser.RawConfigParser() | ||
429 | cc_py.readfp(StringIO(s)) | ||
430 | # compare the two configparsers | ||
431 | self.assertEqualConfig(cc_py, cc) | ||
432 | # check that tidy does not change semantics | ||
433 | tidy(cc) | ||
434 | - cc_tidy = ConfigParser.RawConfigParser() | ||
435 | + cc_tidy = configparser.RawConfigParser() | ||
436 | cc_tidy.readfp(StringIO(str(cc.data))) | ||
437 | self.assertEqualConfig(cc_py, cc_tidy) | ||
438 | except AssertionError: | ||
439 | fname = 'fuzz-test-iter-%d.ini' % fuzz_iter | ||
440 | - print 'Fuzz test failed at iteration', fuzz_iter | ||
441 | - print 'Writing out failing INI file as', fname | ||
442 | + print('Fuzz test failed at iteration', fuzz_iter) | ||
443 | + print('Writing out failing INI file as', fname) | ||
444 | f = open(fname, 'w') | ||
445 | f.write(s) | ||
446 | f.close() | ||
447 | raise | ||
448 | |||
449 | + @unittest.skipIf(sys.version_info[0] > 2, 'http://code.google.com/p/iniparse/issues/detail?id=22#c9') | ||
450 | def assertEqualConfig(self, c1, c2): | ||
451 | self.assertEqualSorted(c1.sections(), c2.sections()) | ||
452 | self.assertEqualSorted(c1.defaults().items(), c2.defaults().items()) | ||
453 | @@ -123,9 +125,7 @@ class test_fuzz(unittest.TestCase): | ||
454 | self.assertEqual(c1.get(sec, opt), c2.get(sec, opt)) | ||
455 | |||
456 | def assertEqualSorted(self, l1, l2): | ||
457 | - l1.sort() | ||
458 | - l2.sort() | ||
459 | - self.assertEqual(l1, l2) | ||
460 | + self.assertEqual(sorted(l1), sorted(l2)) | ||
461 | |||
462 | class suite(unittest.TestSuite): | ||
463 | def __init__(self): | ||
464 | diff --git a/tests/test_ini.py b/tests/test_ini.py | ||
465 | index 6a76edb..07d4f4e 100644 | ||
466 | --- a/tests/test_ini.py | ||
467 | +++ b/tests/test_ini.py | ||
468 | @@ -1,5 +1,5 @@ | ||
469 | import unittest | ||
470 | -from StringIO import StringIO | ||
471 | +from six import StringIO | ||
472 | |||
473 | from iniparse import ini | ||
474 | from iniparse import compat | ||
475 | @@ -196,13 +196,13 @@ but = also me | ||
476 | self.assertEqual(p._data.find('section2').find('just').value, 'kidding') | ||
477 | |||
478 | itr = p._data.finditer('section1') | ||
479 | - v = itr.next() | ||
480 | + v = next(itr) | ||
481 | self.assertEqual(v.find('help').value, 'yourself') | ||
482 | self.assertEqual(v.find('but').value, 'also me') | ||
483 | - v = itr.next() | ||
484 | + v = next(itr) | ||
485 | self.assertEqual(v.find('help').value, 'me') | ||
486 | self.assertEqual(v.find('I\'m').value, 'desperate') | ||
487 | - self.assertRaises(StopIteration, itr.next) | ||
488 | + self.assertRaises(StopIteration, next, itr) | ||
489 | |||
490 | self.assertRaises(KeyError, p._data.find, 'section') | ||
491 | self.assertRaises(KeyError, p._data.find('section2').find, 'ahem') | ||
492 | diff --git a/tests/test_misc.py b/tests/test_misc.py | ||
493 | index 31cf4da..96ef035 100644 | ||
494 | --- a/tests/test_misc.py | ||
495 | +++ b/tests/test_misc.py | ||
496 | @@ -1,9 +1,9 @@ | ||
497 | import re | ||
498 | import unittest | ||
499 | import pickle | ||
500 | -import ConfigParser | ||
501 | +from six.moves import configparser | ||
502 | +from six import StringIO | ||
503 | from textwrap import dedent | ||
504 | -from StringIO import StringIO | ||
505 | from iniparse import compat, ini | ||
506 | |||
507 | class CaseSensitiveConfigParser(compat.ConfigParser): | ||
508 | diff --git a/tests/test_tidy.py b/tests/test_tidy.py | ||
509 | index 7304747..26b6cde 100644 | ||
510 | --- a/tests/test_tidy.py | ||
511 | +++ b/tests/test_tidy.py | ||
512 | @@ -1,6 +1,6 @@ | ||
513 | import unittest | ||
514 | from textwrap import dedent | ||
515 | -from StringIO import StringIO | ||
516 | +from six import StringIO | ||
517 | |||
518 | from iniparse import tidy,INIConfig | ||
519 | from iniparse.ini import EmptyLine | ||
520 | diff --git a/tests/test_unicode.py b/tests/test_unicode.py | ||
521 | index a56fcab..14d4fbd 100644 | ||
522 | --- a/tests/test_unicode.py | ||
523 | +++ b/tests/test_unicode.py | ||
524 | @@ -1,5 +1,5 @@ | ||
525 | import unittest | ||
526 | -from StringIO import StringIO | ||
527 | +import six | ||
528 | from iniparse import compat, ini | ||
529 | |||
530 | class test_unicode(unittest.TestCase): | ||
531 | @@ -17,14 +17,14 @@ baz = Marc-Andr\202 | ||
532 | """ | ||
533 | |||
534 | def basic_tests(self, s, strable): | ||
535 | - f = StringIO(s) | ||
536 | + f = six.StringIO(s) | ||
537 | i = ini.INIConfig(f) | ||
538 | - self.assertEqual(unicode(i), s) | ||
539 | - self.assertEqual(type(i.foo.bar), unicode) | ||
540 | + self.assertEqual(six.text_type(i), s) | ||
541 | + self.assertEqual(type(i.foo.bar), six.text_type) | ||
542 | if strable: | ||
543 | self.assertEqual(str(i), str(s)) | ||
544 | else: | ||
545 | - self.assertRaises(UnicodeEncodeError, lambda: str(i)) | ||
546 | + self.assertRaises(UnicodeEncodeError, lambda: six.text_type(i).encode('ascii')) | ||
547 | return i | ||
548 | |||
549 | def test_ascii(self): | ||
550 | -- | ||
551 | 2.11.0 | ||
552 | |||
diff --git a/meta/recipes-devtools/python/python-iniparse_0.4.bb b/meta/recipes-devtools/python/python3-iniparse_0.4.bb index c6d98c2fdf..44e3c37f85 100644 --- a/meta/recipes-devtools/python/python-iniparse_0.4.bb +++ b/meta/recipes-devtools/python/python3-iniparse_0.4.bb | |||
@@ -4,13 +4,15 @@ LICENSE = "MIT & PSF" | |||
4 | LIC_FILES_CHKSUM = "file://LICENSE-PSF;md5=1c78a5bb3584b353496d5f6f34edb4b2 \ | 4 | LIC_FILES_CHKSUM = "file://LICENSE-PSF;md5=1c78a5bb3584b353496d5f6f34edb4b2 \ |
5 | file://LICENSE;md5=52f28065af11d69382693b45b5a8eb54" | 5 | file://LICENSE;md5=52f28065af11d69382693b45b5a8eb54" |
6 | 6 | ||
7 | SRC_URI = "https://files.pythonhosted.org/packages/source/i/iniparse/iniparse-${PV}.tar.gz" | 7 | SRC_URI = "https://files.pythonhosted.org/packages/source/i/iniparse/iniparse-${PV}.tar.gz \ |
8 | file://0001-Add-python-3-compatibility.patch " | ||
8 | SRC_URI[md5sum] = "5e573e9e9733d97623881ce9bbe5eca6" | 9 | SRC_URI[md5sum] = "5e573e9e9733d97623881ce9bbe5eca6" |
9 | SRC_URI[sha256sum] = "abc1ee12d2cfb2506109072d6c21e40b6c75a3fe90a9c924327d80bc0d99c054" | 10 | SRC_URI[sha256sum] = "abc1ee12d2cfb2506109072d6c21e40b6c75a3fe90a9c924327d80bc0d99c054" |
10 | 11 | ||
11 | inherit distutils | 12 | inherit distutils3 |
12 | 13 | ||
13 | RDEPENDS_${PN} += "python-core" | 14 | RDEPENDS_${PN} += "python3-core python3-six" |
15 | DEPENDS += "python3-six" | ||
14 | 16 | ||
15 | BBCLASSEXTEND = "native nativesdk" | 17 | BBCLASSEXTEND = "native nativesdk" |
16 | 18 | ||
diff --git a/meta/recipes-devtools/python/python-pygpgme_0.3.bb b/meta/recipes-devtools/python/python3-pygpgme_0.3.bb index ac8bc9d62e..495f677cfa 100644 --- a/meta/recipes-devtools/python/python-pygpgme_0.3.bb +++ b/meta/recipes-devtools/python/python3-pygpgme_0.3.bb | |||
@@ -9,10 +9,10 @@ SRC_URI[sha256sum] = "5fd887c407015296a8fd3f4b867fe0fcca3179de97ccde90449853a3df | |||
9 | 9 | ||
10 | S = "${WORKDIR}/pygpgme-${PV}" | 10 | S = "${WORKDIR}/pygpgme-${PV}" |
11 | 11 | ||
12 | inherit distutils | 12 | inherit distutils3 |
13 | 13 | ||
14 | DEPENDS = "gpgme python" | 14 | DEPENDS = "gpgme python3" |
15 | 15 | ||
16 | RDEPENDS_${PN} += "python-core" | 16 | RDEPENDS_${PN} += "python3-core" |
17 | 17 | ||
18 | BBCLASSEXTEND = "native nativesdk" | 18 | BBCLASSEXTEND = "native nativesdk" |
diff --git a/meta/recipes-devtools/rpm/files/0001-Add-PYTHON_ABI-when-searching-for-python-libraries.patch b/meta/recipes-devtools/rpm/files/0001-Add-PYTHON_ABI-when-searching-for-python-libraries.patch new file mode 100644 index 0000000000..b809332f21 --- /dev/null +++ b/meta/recipes-devtools/rpm/files/0001-Add-PYTHON_ABI-when-searching-for-python-libraries.patch | |||
@@ -0,0 +1,30 @@ | |||
1 | From 36cf0ff26ece53e529e8b4f2d2f09acd8794b055 Mon Sep 17 00:00:00 2001 | ||
2 | From: Alexander Kanavin <alex.kanavin@gmail.com> | ||
3 | Date: Fri, 24 Mar 2017 15:35:47 +0200 | ||
4 | Subject: [PATCH] Add PYTHON_ABI when searching for python libraries. | ||
5 | |||
6 | It has a value of 'm' when using Python3, and so without it | ||
7 | configure will not find the libraries. | ||
8 | |||
9 | Upstream-Status: Inappropriate [oe-core specific] | ||
10 | Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> | ||
11 | --- | ||
12 | configure.ac | 2 +- | ||
13 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
14 | |||
15 | diff --git a/configure.ac b/configure.ac | ||
16 | index 9c58467c1..a506ec819 100644 | ||
17 | --- a/configure.ac | ||
18 | +++ b/configure.ac | ||
19 | @@ -642,7 +642,7 @@ AS_IF([test "$enable_python" = yes],[ | ||
20 | ]) | ||
21 | CPPFLAGS="$save_CPPFLAGS" | ||
22 | save_LIBS="$LIBS" | ||
23 | - AC_SEARCH_LIBS([Py_Main],[python${PYTHON_VERSION} python],[ | ||
24 | + AC_SEARCH_LIBS([Py_Main],[python${PYTHON_VERSION}${PYTHON_ABI} python],[ | ||
25 | WITH_PYTHON_LIB="$ac_res" | ||
26 | ],[AC_MSG_ERROR([missing python library]) | ||
27 | ]) | ||
28 | -- | ||
29 | 2.11.0 | ||
30 | |||
diff --git a/meta/recipes-devtools/rpm/rpm_git.bb b/meta/recipes-devtools/rpm/rpm_git.bb index 9bccd91168..96f71d5bb5 100644 --- a/meta/recipes-devtools/rpm/rpm_git.bb +++ b/meta/recipes-devtools/rpm/rpm_git.bb | |||
@@ -13,8 +13,8 @@ simplify the process of creating graphical package managers or any \ | |||
13 | other tools that need an intimate knowledge of RPM packages in order \ | 13 | other tools that need an intimate knowledge of RPM packages in order \ |
14 | to function." | 14 | to function." |
15 | 15 | ||
16 | SUMMARY_python-rpm = "Python bindings for apps which will manupulate RPM packages" | 16 | SUMMARY_python3-rpm = "Python bindings for apps which will manupulate RPM packages" |
17 | DESCRIPTION_python-rpm = "The rpm-python package contains a module that permits applications \ | 17 | DESCRIPTION_python3-rpm = "The python3-rpm package contains a module that permits applications \ |
18 | written in the Python programming language to use the interface \ | 18 | written in the Python programming language to use the interface \ |
19 | supplied by the RPM Package Manager libraries." | 19 | supplied by the RPM Package Manager libraries." |
20 | 20 | ||
@@ -34,6 +34,7 @@ SRC_URI = "git://github.com/rpm-software-management/rpm \ | |||
34 | file://0001-Do-not-hardcode-lib-rpm-as-the-installation-path-for.patch \ | 34 | file://0001-Do-not-hardcode-lib-rpm-as-the-installation-path-for.patch \ |
35 | file://0001-Fix-build-with-musl-C-library.patch \ | 35 | file://0001-Fix-build-with-musl-C-library.patch \ |
36 | file://0001-Add-a-color-setting-for-mips64_n32-binaries.patch \ | 36 | file://0001-Add-a-color-setting-for-mips64_n32-binaries.patch \ |
37 | file://0001-Add-PYTHON_ABI-when-searching-for-python-libraries.patch \ | ||
37 | " | 38 | " |
38 | 39 | ||
39 | PV = "4.13.90+git${SRCPV}" | 40 | PV = "4.13.90+git${SRCPV}" |
@@ -42,10 +43,11 @@ SRCREV = "a8e51b3bb05c6acb1d9b2e3d34f859ddda1677be" | |||
42 | 43 | ||
43 | S = "${WORKDIR}/git" | 44 | S = "${WORKDIR}/git" |
44 | 45 | ||
45 | DEPENDS = "nss libarchive db file popt xz dbus elfutils python" | 46 | DEPENDS = "nss libarchive db file popt xz dbus elfutils python3" |
46 | DEPENDS_append_class-native = " file-replacement-native" | 47 | DEPENDS_append_class-native = " file-replacement-native" |
47 | 48 | ||
48 | inherit autotools gettext pkgconfig pythonnative | 49 | inherit autotools gettext pkgconfig python3native |
50 | export PYTHON_ABI | ||
49 | 51 | ||
50 | # OE-core patches autoreconf to additionally run gnu-configize, which fails with this recipe | 52 | # OE-core patches autoreconf to additionally run gnu-configize, which fails with this recipe |
51 | EXTRA_AUTORECONF_append = " --exclude=gnu-configize" | 53 | EXTRA_AUTORECONF_append = " --exclude=gnu-configize" |
@@ -102,9 +104,9 @@ FILES_${PN} += "${libdir}/rpm-plugins/*.so \ | |||
102 | FILES_${PN}-dev += "${libdir}/rpm-plugins/*.la \ | 104 | FILES_${PN}-dev += "${libdir}/rpm-plugins/*.la \ |
103 | " | 105 | " |
104 | 106 | ||
105 | PACKAGES += "python-rpm" | 107 | PACKAGES += "python3-rpm" |
106 | PROVIDES += "python-rpm" | 108 | PROVIDES += "python3-rpm" |
107 | FILES_python-rpm = "${PYTHON_SITEPACKAGES_DIR}/rpm/*" | 109 | FILES_python3-rpm = "${PYTHON_SITEPACKAGES_DIR}/rpm/*" |
108 | 110 | ||
109 | # rpm 5.x was packaging the rpm build tools separately | 111 | # rpm 5.x was packaging the rpm build tools separately |
110 | RPROVIDES_${PN} += "rpm-build" | 112 | RPROVIDES_${PN} += "rpm-build" |