[oe] [meta-oe][PATCH 1/3] pcsc-lite: update recipe to use python3
Andreas Oberritter
obi at opendreambox.org
Mon Jan 27 20:16:18 UTC 2020
Hi Andrey,
On Mon, 27 Jan 2020 17:36:06 +0000
Andrey Zhizhikin <andrey.z at gmail.com> wrote:
> From: Andrey Zhizhikin <andrey.z at gmail.com>
>
> Update pcsc-lite recipe to target python3 since python2 is EOL and has
> been dropped from OE-Core.
>
> Signed-off-by: Andrey Zhizhikin <andrey.z at gmail.com>
> ---
> .../0001-pcsc-spy-use-python3-only.patch | 43 +++++++++++++++++++
> .../pcsc-lite/pcsc-lite_1.8.26.bb | 7 ++-
> 2 files changed, 48 insertions(+), 2 deletions(-)
> create mode 100644 meta-oe/recipes-support/pcsc-lite/pcsc-lite/0001-pcsc-spy-use-python3-only.patch
>
> diff --git a/meta-oe/recipes-support/pcsc-lite/pcsc-lite/0001-pcsc-spy-use-python3-only.patch b/meta-oe/recipes-support/pcsc-lite/pcsc-lite/0001-pcsc-spy-use-python3-only.patch
> new file mode 100644
> index 000000000..3e7b0adda
> --- /dev/null
> +++ b/meta-oe/recipes-support/pcsc-lite/pcsc-lite/0001-pcsc-spy-use-python3-only.patch
> @@ -0,0 +1,43 @@
> +From 75dd98876951d86890ceb30be521de57fd31e3c7 Mon Sep 17 00:00:00 2001
> +From: Andrey Zhizhikin <andrey.z at gmail.com>
> +Date: Mon, 27 Jan 2020 13:27:12 +0000
> +Subject: [PATCH] pcsc-spy: use python3 only
> +
> +Python2 has been EOL and most distributions would not provide any
> +support for it anymore. Since Python3 is available in all distributions
> +now, switch pcsc-spy to use it exclusively.
> +
> +Upstream-Status: Pending
> +
> +Signed-off-by: Andrey Zhizhikin <andrey.z at gmail.com>
> +---
> + src/spy/pcsc-spy | 9 ++-------
> + 1 file changed, 2 insertions(+), 7 deletions(-)
> +
> +diff --git a/src/spy/pcsc-spy b/src/spy/pcsc-spy
> +index 85222c6..965138e 100755
> +--- a/src/spy/pcsc-spy
> ++++ b/src/spy/pcsc-spy
> +@@ -1,4 +1,4 @@
> +-#! /usr/bin/python
> ++#!/usr/bin/env python3
> +
> + """
> + # Display PC/SC functions arguments
> +@@ -22,12 +22,7 @@ from __future__ import print_function
> + import os
> + import signal
> + import time
> +-try:
> +- # for Python3
> +- from queue import Queue
> +-except ImportError:
> +- # for Python2
> +- from Queue import Queue
> ++from queue import Queue
> + from threading import Thread
> + from operator import attrgetter
> +
> +--
> +2.17.1
> +
This patch would not have been necessary if we managed the python symlink with update-alternatives. I'm doing this in my layer. Maybe that would be a better way to go? I won't be able to build master in the next days or weeks, but if you want to try and submit it, here's what I have in my bbappends:
python_%.bbappend:
inherit update-alternatives
ALTERNATIVE_${PN}-core = "python"
ALTERNATIVE_TARGET[python] = "${bindir}/python2"
ALTERNATIVE_PRIORITY = "2"
do_install_append_class-target() {
rm -f ${D}${bindir}/python
}
python3_%.bbappend:
inherit update-alternatives
ALTERNATIVE_${PN}-core = "python"
ALTERNATIVE_TARGET[python] = "${bindir}/python3"
ALTERNATIVE_PRIORITY = "3"
Best regards,
Andreas
More information about the Openembedded-devel
mailing list