Skip to contentSkip to conversation

python3-pbr: change shebang to python3

PATCH In review Changqing Li 3 participants 6 messages Apr 24, 2020 – Apr 26, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 python3-pbr: change shebang to python3

From: Changqing Li <[email protected]>

we have offcially dropped python2, so it is possible that our code run on python3 only host, so change shebang to python3 to avoid error like:
python: command not found

---
 meta/recipes-devtools/python/python-pbr.inc   |  2 +
 .../0001-change-shebang-to-python3.patch      | 42 +++++++++++++++++++
 2 files changed, 44 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3-pbr/0001-change-shebang-to-python3.patch
meta/recipes-devtools/python/python-pbr.inc +2 -0
index 0e64501c32..ce3c224d51 100644
@@ -5,6 +5,8 @@ SECTION = "devel/python"
 LICENSE = "Apache-2.0"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=1dece7821bf3fd70fe1309eaa37d52a2"
 
+SRC_URI += "file://0001-change-shebang-to-python3.patch"
+
 inherit pypi
 
 RDEPENDS_${PN} += "${PYTHON_PN}-pip"
meta/recipes-devtools/python/python3-pbr/0001-change-shebang-to-python3.patch new file +42 -0

42 lines not on this page · raw message

Signature · 1 line
2.24.1
#1 lore raw

PATCH 2/3 python3-pip: change shebang to python3

From: Changqing Li <[email protected]>

we have offcially dropped python2, so it is possible that our code run on python3 only host, so change shebang to python3 to avoid error like:
python: command not found

---
 .../0001-change-shebang-to-python3.patch      | 60 +++++++++++++++++++
 .../python/python3-pip_20.0.2.bb              |  2 +
 2 files changed, 62 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3-pip/0001-change-shebang-to-python3.patch
meta/recipes-devtools/python/python3-pip/0001-change-shebang-to-python3.patch new file +60 -0
new file mode 100644
index 0000000000..00cffe169b
@@ -0,0 +1,60 @@
+From e7a00e9b5104ae2fbcea32a35c85760b77fae7e5 Mon Sep 17 00:00:00 2001
+From: Changqing Li <[email protected]>
+Date: Thu, 23 Apr 2020 09:42:10 +0000
+Subject: [PATCH] change shebang to python3
+
+Upstream-Status: Pending
+
+pip will drop support of python2 from 21.0
+
+Signed-off-by: Changqing Li <[email protected]>
+---
+ src/pip/_internal/__init__.py             | 2 +-
+ src/pip/_vendor/appdirs.py                | 2 +-
+ src/pip/_vendor/chardet/cli/chardetect.py | 2 +-
+ src/pip/_vendor/requests/certs.py         | 2 +-
+ 4 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/src/pip/_internal/__init__.py b/src/pip/_internal/__init__.py
+index 3aa8a46..e1ad179 100755
+--- a/src/pip/_internal/__init__.py
++++ b/src/pip/_internal/__init__.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python3
+ import pip._internal.utils.inject_securetransport  # noqa
+ from pip._internal.utils.typing import MYPY_CHECK_RUNNING
+ 
+diff --git a/src/pip/_vendor/appdirs.py b/src/pip/_vendor/appdirs.py
+index 3a52b75..ad3f81d 100644
+--- a/src/pip/_vendor/appdirs.py
++++ b/src/pip/_vendor/appdirs.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python3
+ # -*- coding: utf-8 -*-
+ # Copyright (c) 2005-2010 ActiveState Software Inc.
+ # Copyright (c) 2013 Eddy Petrișor
+diff --git a/src/pip/_vendor/chardet/cli/chardetect.py b/src/pip/_vendor/chardet/cli/chardetect.py
+index c61136b..a497e98 100644
+--- a/src/pip/_vendor/chardet/cli/chardetect.py
++++ b/src/pip/_vendor/chardet/cli/chardetect.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python3
+ """
+ Script which takes one or more file paths and reports on their detected
+ encodings
+diff --git a/src/pip/_vendor/requests/certs.py b/src/pip/_vendor/requests/certs.py
+index 06a594e..bfa7839 100644
+--- a/src/pip/_vendor/requests/certs.py
++++ b/src/pip/_vendor/requests/certs.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python3
+ # -*- coding: utf-8 -*-
+ 
+ """
+-- 
+2.24.1
+
meta/recipes-devtools/python/python3-pip_20.0.2.bb +2 -0
index 08738fb2f9..96973db774 100644
@@ -6,6 +6,8 @@ LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=8ba06d529c955048e5ddd7c45459eb2e"
 
 DEPENDS += "python3 python3-setuptools-native"
 
+SRC_URI += "file://0001-change-shebang-to-python3.patch"
+
 SRC_URI[md5sum] = "7d42ba49b809604f0df3d55df1c3fd86"
 SRC_URI[sha256sum] = "7db0c8ea4c7ea51c8049640e8e6e7fde949de672bfa4949920675563a5a6967f"
 
Signature · 1 line
2.24.1
#2 lore raw

PATCH 3/3 python3-setuptools: change shebang to python3

In reply to Changqing Li

From: Changqing Li <[email protected]>

we have offcially dropped python2, so it is possible that our code run on python3 only host, so change shebang to python3 to avoid error like:
python: command not found

---
 .../python/python-setuptools.inc              |  2 ++
 .../0001-change-shebang-to-python3.patch      | 36 +++++++++++++++++++
 2 files changed, 38 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3-setuptools/0001-change-shebang-to-python3.patch
meta/recipes-devtools/python/python-setuptools.inc +2 -0
index f7c3202fde..07c2f8b216 100644
@@ -10,6 +10,8 @@ inherit pypi
 
 SRC_URI_append_class-native = " file://0001-conditionally-do-not-fetch-code-by-easy_install.patch"
 
+SRC_URI += "file://0001-change-shebang-to-python3.patch"
+
 SRC_URI[md5sum] = "0c956eea142af9c2b02d72e3c042af30"
 SRC_URI[sha256sum] = "89c6e6011ec2f6d57d43a3f9296c4ef022c2cbf49bab26b407fe67992ae3397f"
 
meta/recipes-devtools/python/python3-setuptools/0001-change-shebang-to-python3.patch new file +36 -0
new file mode 100644
index 0000000000..33af8daed7
@@ -0,0 +1,36 @@
+From c39d0896930e25c224cc897660fc8511ccae30c8 Mon Sep 17 00:00:00 2001
+From: Changqing Li <[email protected]>
+Date: Thu, 23 Apr 2020 10:01:12 +0000
+Subject: [PATCH] change shebang to python3
+
+Upstream-Status: Pending
+
+Signed-off-by: Changqing Li <[email protected]>
+---
+ pkg_resources/_vendor/appdirs.py   | 2 +-
+ setuptools/command/easy_install.py | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/pkg_resources/_vendor/appdirs.py b/pkg_resources/_vendor/appdirs.py
+index ae67001..933e398 100644
+--- a/pkg_resources/_vendor/appdirs.py
++++ b/pkg_resources/_vendor/appdirs.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python3
+ # -*- coding: utf-8 -*-
+ # Copyright (c) 2005-2010 ActiveState Software Inc.
+ # Copyright (c) 2013 Eddy Petrișor
+diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
+index abca1ae..6bcdc98 100644
+--- a/setuptools/command/easy_install.py
++++ b/setuptools/command/easy_install.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python3
+ """
+ Easy Install
+ ------------
+-- 
+2.24.1
+
Signature · 1 line
2.24.1
#3 lore raw
In reply to Changqing Li
Quoted 6 lines · Changqing Li

From: Changqing Li <[email protected]>

we have offcially dropped python2, so it is possible that our code run on python3 only host, so change shebang to python3 to avoid error like:
python: command not found

I worry this is going to be the start of a huge pile or unstreamable patches. We may have to provide "python" on target but that probably is a policy decision we should discuss.

Cheers,

Richard

#4 lore raw
Quoted 12 lines · Richard Purdie
Quoted 6 lines · Changqing Li

From: Changqing Li <[email protected]>

we have offcially dropped python2, so it is possible that our code run on python3 only host, so change shebang to python3 to avoid error like:
python: command not found

I worry this is going to be the start of a huge pile or unstreamable patches. We may have to provide "python" on target but that probably is a policy decision we should discuss.

I think python as python3 is used by some distros, but it sets up for same py2->py3 problem when python4 comes out, so perhaps calling out version specific python is a good approach but I think such patches should be accepted upstream first. OE should not define its own policy without upstream python's decision to move forward.

Quoted 7 lines

Cheers,

Richard

#5 lore raw
Quoted 13 lines · Khem Raj
Quoted 11 lines · Richard Purdie
Quoted 6 lines · Changqing Li

From: Changqing Li <[email protected]>

we have offcially dropped python2, so it is possible that our code run on python3 only host, so change shebang to python3 to avoid error like:
python: command not found

I worry this is going to be the start of a huge pile or unstreamable patches. We may have to provide "python" on target but that probably is a policy decision we should discuss.

Quoted 5 lines

I think python as python3 is used by some distros, but it sets up for same py2->py3 problem when python4 comes out, so perhaps calling out version specific python is a good approach but I think such patches should be accepted upstream first. OE should not define its own policy without upstream python's decision to move forward.

Here is some info related to this:

https://www.python.org/dev/peps/pep-0394/

It says:

---
Distributors may choose to set the behavior of the python command as follows:

python2,
python3,
not provide python command,
allow python to be configurable by an end user or a system administrator.
---

And fedora31 use python as python3,  which realized by install python-unversioned-command <https://apps.fedoraproject.org/packages/python-unversioned-command>

refer:https://fedoraproject.org/wiki/Changes/Python_means_Python3

but fedora31 image on docker hub don't install python-unversioned-command,  so there is no python.
<https://apps.fedoraproject.org/packages/python-unversioned-command>

packages like  python3-pip,   they officially said,  they will drop python from 21.0, and now we have 20.0.2,

so for upstream,  they support both python2 and python3,  in this condition,  maybe upstream will not

accept change shebang from python to python3.  but I will report this to upstream to see what's their opinion.

Quoted 8 lines
Quoted 8 lines

Cheers,

Richard