[oe-commits] [openembedded-core] 02/05: python: make python2 and python3 alternatives to python
git at git.openembedded.org
git at git.openembedded.org
Thu Apr 13 10:04:25 UTC 2017
This is an automated email from the git hooks/post-receive script.
rpurdie pushed a commit to branch master-next
in repository openembedded-core.
commit dbaf3443677b43325f3c3ef767dd39cf2b2cc3aa
Author: Dmitry Rozhkov <dmitry.rozhkov at linux.intel.com>
AuthorDate: Thu Apr 13 11:33:44 2017 +0300
python: make python2 and python3 alternatives to python
If only python3 is installed on an image nothing provides
/usr/bin/python even though many scripts compatible with
both python2 and python3 just state `#!/usr/bin/env python`
in their shebang line.
Make python and python3 recipes provide alternatives for
/usr/bin/python and /usr/bin/python-config. By default
python2 has higher priority over python3.
Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov at linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
meta/recipes-devtools/python/python3_3.5.2.bb | 9 +++++++++
meta/recipes-devtools/python/python_2.7.13.bb | 7 +++++++
2 files changed, 16 insertions(+)
diff --git a/meta/recipes-devtools/python/python3_3.5.2.bb b/meta/recipes-devtools/python/python3_3.5.2.bb
index 2ff7c9e..310d43f 100644
--- a/meta/recipes-devtools/python/python3_3.5.2.bb
+++ b/meta/recipes-devtools/python/python3_3.5.2.bb
@@ -221,4 +221,13 @@ FILES_${PN}-misc = "${libdir}/python${PYTHON_MAJMIN}"
PACKAGES += "${PN}-man"
FILES_${PN}-man = "${datadir}/man"
+inherit update-alternatives
+
+ALTERNATIVE_PRIORITY = "80"
+ALTERNATIVE_${PN}-core = "python python_config"
+ALTERNATIVE_LINK_NAME[python] = "${bindir}/python"
+ALTERNATIVE_LINK_NAME[python_config] = "${bindir}/python-config"
+ALTERNATIVE_TARGET[python] = "${bindir}/python3"
+ALTERNATIVE_TARGET[python_config] = "${bindir}/python3-config"
+
BBCLASSEXTEND = "nativesdk"
diff --git a/meta/recipes-devtools/python/python_2.7.13.bb b/meta/recipes-devtools/python/python_2.7.13.bb
index 4ef9952..0cf7498 100644
--- a/meta/recipes-devtools/python/python_2.7.13.bb
+++ b/meta/recipes-devtools/python/python_2.7.13.bb
@@ -168,4 +168,11 @@ do_install_ptest() {
PACKAGES += "${PN}-man"
FILES_${PN}-man = "${datadir}/man"
+inherit update-alternatives
+
+ALTERNATIVE_PRIORITY = "100"
+ALTERNATIVE_${PN}-core = "python python_config"
+ALTERNATIVE_LINK_NAME[python] = "${bindir}/python"
+ALTERNATIVE_LINK_NAME[python_config] = "${bindir}/python-config"
+
BBCLASSEXTEND = "nativesdk"
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list