* [PR PATCH] Make python3 default in 03-rewrite-pyton-shebang.sh hook
@ 2020-04-18 19:49 ahesford
2020-04-18 19:49 ` xtraeme
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: ahesford @ 2020-04-18 19:49 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 809 bytes --]
There is a new pull request by ahesford against master on the void-packages repository
https://github.com/ahesford/void-packages hooks
https://github.com/void-linux/void-packages/pull/21132
Make python3 default in 03-rewrite-pyton-shebang.sh hook
The `03-rewrite-python-shebang.sh` hook assumes `python2` by default, overriding only if `python_version` or `pycompile_version` are set, or the package installs some modules in `/usr/lib/python*`.
Not all packages that install Python scripts set these variables or install modules, so the shebang is forced to `python2` by default. Because `python2` is EOL, I think it is sensible to assume these packages are doing the right thing and targeting `python3` instead.
A patch file from https://github.com/void-linux/void-packages/pull/21132.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-hooks-21132.patch --]
[-- Type: text/x-diff, Size: 846 bytes --]
From b7809a4ec08d2b8377bb52fdf6a38ffcffed84c9 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Sat, 18 Apr 2020 15:42:46 -0400
Subject: [PATCH] Make python3 default in 03-rewrite-python-shebang.sh hook
---
common/hooks/pre-pkg/03-rewrite-python-shebang.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
index 4de75da2a76..7114143b73d 100644
--- a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
+++ b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
@@ -4,7 +4,7 @@
hook() {
local pyver= shebang= off=
- : ${pyver:=2}
+ : ${pyver:=3}
if [ -d ${PKGDESTDIR}/usr/lib/python* ]; then
pyver="$(find ${PKGDESTDIR}/usr/lib/python* -prune -type d | grep -o '[[:digit:]]\.[[:digit:]]$')"
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Make python3 default in 03-rewrite-pyton-shebang.sh hook
2020-04-18 19:49 [PR PATCH] Make python3 default in 03-rewrite-pyton-shebang.sh hook ahesford
@ 2020-04-18 19:49 ` xtraeme
2020-04-18 20:34 ` Chocimier
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: xtraeme @ 2020-04-18 19:49 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 143 bytes --]
New comment by xtraeme on void-packages repository
https://github.com/void-linux/void-packages/pull/21132#issuecomment-615934864
Comment:
+1
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Make python3 default in 03-rewrite-pyton-shebang.sh hook
2020-04-18 19:49 [PR PATCH] Make python3 default in 03-rewrite-pyton-shebang.sh hook ahesford
2020-04-18 19:49 ` xtraeme
@ 2020-04-18 20:34 ` Chocimier
2020-04-20 1:25 ` [PR PATCH] [Updated] " ahesford
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Chocimier @ 2020-04-18 20:34 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 525 bytes --]
New comment by Chocimier on void-packages repository
https://github.com/void-linux/void-packages/pull/21132#issuecomment-615943118
Comment:
Needs change in following `"$python_version" = "3"`.
This should be changed in sync with #14680 and https://github.com/void-linux/void-packages/blob/master/common/hooks/post-install/04-create-xbps-metadata-scripts.sh#L269 .
`pycompile_version` look redundant, setting python_version from template could be enough.
BTW I am working on removing of py2-based waf build style.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PR PATCH] [Updated] Make python3 default in 03-rewrite-pyton-shebang.sh hook
2020-04-18 19:49 [PR PATCH] Make python3 default in 03-rewrite-pyton-shebang.sh hook ahesford
2020-04-18 19:49 ` xtraeme
2020-04-18 20:34 ` Chocimier
@ 2020-04-20 1:25 ` ahesford
2020-04-20 1:27 ` ahesford
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: ahesford @ 2020-04-20 1:25 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 814 bytes --]
There is an updated pull request by ahesford against master on the void-packages repository
https://github.com/ahesford/void-packages hooks
https://github.com/void-linux/void-packages/pull/21132
Make python3 default in 03-rewrite-pyton-shebang.sh hook
The `03-rewrite-python-shebang.sh` hook assumes `python2` by default, overriding only if `python_version` or `pycompile_version` are set, or the package installs some modules in `/usr/lib/python*`.
Not all packages that install Python scripts set these variables or install modules, so the shebang is forced to `python2` by default. Because `python2` is EOL, I think it is sensible to assume these packages are doing the right thing and targeting `python3` instead.
A patch file from https://github.com/void-linux/void-packages/pull/21132.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-hooks-21132.patch --]
[-- Type: text/x-diff, Size: 2114 bytes --]
From b8fac295f40567be5f863be17c67dee9e42eccb5 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Sat, 18 Apr 2020 15:42:46 -0400
Subject: [PATCH] Make python3 default in XBPS environment and hooks
---
common/environment/setup/python.sh | 4 ++--
common/hooks/post-install/04-create-xbps-metadata-scripts.sh | 2 +-
common/hooks/pre-pkg/03-rewrite-python-shebang.sh | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/common/environment/setup/python.sh b/common/environment/setup/python.sh
index ba181d45361..60f235b968c 100644
--- a/common/environment/setup/python.sh
+++ b/common/environment/setup/python.sh
@@ -2,8 +2,8 @@
# Useful variables for determining Python version and paths.
#
-# set version 2 as the default Python
-python_version="2"
+# set version 3 as the default Python
+python_version="3"
py2_ver="2.7"
py2_lib="/usr/lib/python${py2_ver}"
diff --git a/common/hooks/post-install/04-create-xbps-metadata-scripts.sh b/common/hooks/post-install/04-create-xbps-metadata-scripts.sh
index 3b1089cd410..83d172d0abe 100644
--- a/common/hooks/post-install/04-create-xbps-metadata-scripts.sh
+++ b/common/hooks/post-install/04-create-xbps-metadata-scripts.sh
@@ -266,7 +266,7 @@ _EOF
fi
if [ -n "${pycompile_dirs}" -o -n "${pycompile_module}" ]; then
- echo "export pycompile_version=\"${pycompile_version:=2.7}\"" >>$tmpf
+ echo "export pycompile_version=\"${pycompile_version:=3.8}\"" >>$tmpf
if [ -n "${pycompile_dirs}" ]; then
echo "export pycompile_dirs=\"${pycompile_dirs}\"" >>$tmpf
fi
diff --git a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
index 4de75da2a76..7114143b73d 100644
--- a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
+++ b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
@@ -4,7 +4,7 @@
hook() {
local pyver= shebang= off=
- : ${pyver:=2}
+ : ${pyver:=3}
if [ -d ${PKGDESTDIR}/usr/lib/python* ]; then
pyver="$(find ${PKGDESTDIR}/usr/lib/python* -prune -type d | grep -o '[[:digit:]]\.[[:digit:]]$')"
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Make python3 default in 03-rewrite-pyton-shebang.sh hook
2020-04-18 19:49 [PR PATCH] Make python3 default in 03-rewrite-pyton-shebang.sh hook ahesford
` (2 preceding siblings ...)
2020-04-20 1:25 ` [PR PATCH] [Updated] " ahesford
@ 2020-04-20 1:27 ` ahesford
2020-04-20 1:32 ` Make python3 default in XBPS environment and hooks q66
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: ahesford @ 2020-04-20 1:27 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 288 bytes --]
New comment by ahesford on void-packages repository
https://github.com/void-linux/void-packages/pull/21132#issuecomment-616262181
Comment:
OK, I incorporated changes from #14680 and the `04-create-xbps-metadata-scripts.sh` hook. The move to python3 by default should be consistent now.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Make python3 default in XBPS environment and hooks
2020-04-18 19:49 [PR PATCH] Make python3 default in 03-rewrite-pyton-shebang.sh hook ahesford
` (3 preceding siblings ...)
2020-04-20 1:27 ` ahesford
@ 2020-04-20 1:32 ` q66
2020-04-20 2:03 ` ahesford
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: q66 @ 2020-04-20 1:32 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 378 bytes --]
New comment by q66 on void-packages repository
https://github.com/void-linux/void-packages/pull/21132#issuecomment-616263378
Comment:
by doing this you're effectively potentially breaking a bunch of stuff and you won't even know about it
i don't think we need to do this for python3 migration, just gradually move everything over, *then* do the switch when python2 is gone
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Make python3 default in XBPS environment and hooks
2020-04-18 19:49 [PR PATCH] Make python3 default in 03-rewrite-pyton-shebang.sh hook ahesford
` (4 preceding siblings ...)
2020-04-20 1:32 ` Make python3 default in XBPS environment and hooks q66
@ 2020-04-20 2:03 ` ahesford
2020-04-20 2:21 ` q66
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: ahesford @ 2020-04-20 2:03 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 303 bytes --]
New comment by ahesford on void-packages repository
https://github.com/void-linux/void-packages/pull/21132#issuecomment-616269627
Comment:
You raise a good point. I'll look instead at emitting a warning (or, eventually, an error) if python_version is not explicitly defined in templates that need it.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Make python3 default in XBPS environment and hooks
2020-04-18 19:49 [PR PATCH] Make python3 default in 03-rewrite-pyton-shebang.sh hook ahesford
` (5 preceding siblings ...)
2020-04-20 2:03 ` ahesford
@ 2020-04-20 2:21 ` q66
2020-04-20 18:11 ` Chocimier
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: q66 @ 2020-04-20 2:21 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 372 bytes --]
New comment by q66 on void-packages repository
https://github.com/void-linux/void-packages/pull/21132#issuecomment-616273415
Comment:
as i mentioned on irc we should really compile a list of packages contaning python scripts that don't begin with `python-` or `python3-`, then properly tag their python version in templates, then drop a default and make it a hard error
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Make python3 default in XBPS environment and hooks
2020-04-18 19:49 [PR PATCH] Make python3 default in 03-rewrite-pyton-shebang.sh hook ahesford
` (6 preceding siblings ...)
2020-04-20 2:21 ` q66
@ 2020-04-20 18:11 ` Chocimier
2020-04-20 20:12 ` ahesford
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Chocimier @ 2020-04-20 18:11 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 265 bytes --]
New comment by Chocimier on void-packages repository
https://github.com/void-linux/void-packages/pull/21132#issuecomment-616723980
Comment:
+1 for q66's proposal. But build_style is better criterion than name prefix.
Abandoning pycompile_version here: #21191
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Make python3 default in XBPS environment and hooks
2020-04-18 19:49 [PR PATCH] Make python3 default in 03-rewrite-pyton-shebang.sh hook ahesford
` (7 preceding siblings ...)
2020-04-20 18:11 ` Chocimier
@ 2020-04-20 20:12 ` ahesford
2020-04-20 20:12 ` [PR PATCH] [Closed]: " ahesford
2020-04-20 20:13 ` ahesford
10 siblings, 0 replies; 12+ messages in thread
From: ahesford @ 2020-04-20 20:12 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 416 bytes --]
New comment by ahesford on void-packages repository
https://github.com/void-linux/void-packages/pull/21132#issuecomment-616782606
Comment:
duncaen is running a script for me to grab the first python shebang from every package in the repo (when it exists). I'll filter this list and make a better proposal along the lines of q66's recommendation after expicitly setting python_version as necessary on all packages.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PR PATCH] [Closed]: Make python3 default in XBPS environment and hooks
2020-04-18 19:49 [PR PATCH] Make python3 default in 03-rewrite-pyton-shebang.sh hook ahesford
` (8 preceding siblings ...)
2020-04-20 20:12 ` ahesford
@ 2020-04-20 20:12 ` ahesford
2020-04-20 20:13 ` ahesford
10 siblings, 0 replies; 12+ messages in thread
From: ahesford @ 2020-04-20 20:12 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 652 bytes --]
There's a closed pull request on the void-packages repository
Make python3 default in XBPS environment and hooks
https://github.com/void-linux/void-packages/pull/21132
Description:
The `03-rewrite-python-shebang.sh` hook assumes `python2` by default, overriding only if `python_version` or `pycompile_version` are set, or the package installs some modules in `/usr/lib/python*`.
Not all packages that install Python scripts set these variables or install modules, so the shebang is forced to `python2` by default. Because `python2` is EOL, I think it is sensible to assume these packages are doing the right thing and targeting `python3` instead.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Make python3 default in XBPS environment and hooks
2020-04-18 19:49 [PR PATCH] Make python3 default in 03-rewrite-pyton-shebang.sh hook ahesford
` (9 preceding siblings ...)
2020-04-20 20:12 ` [PR PATCH] [Closed]: " ahesford
@ 2020-04-20 20:13 ` ahesford
10 siblings, 0 replies; 12+ messages in thread
From: ahesford @ 2020-04-20 20:13 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 417 bytes --]
New comment by ahesford on void-packages repository
https://github.com/void-linux/void-packages/pull/21132#issuecomment-616782606
Comment:
duncaen is running a script for me to grab the first python shebang from every package in the repo (when one exists). I'll filter this list and make a better proposal along the lines of q66's recommendation after expicitly setting python_version as necessary on all packages.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2020-04-20 20:13 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-18 19:49 [PR PATCH] Make python3 default in 03-rewrite-pyton-shebang.sh hook ahesford
2020-04-18 19:49 ` xtraeme
2020-04-18 20:34 ` Chocimier
2020-04-20 1:25 ` [PR PATCH] [Updated] " ahesford
2020-04-20 1:27 ` ahesford
2020-04-20 1:32 ` Make python3 default in XBPS environment and hooks q66
2020-04-20 2:03 ` ahesford
2020-04-20 2:21 ` q66
2020-04-20 18:11 ` Chocimier
2020-04-20 20:12 ` ahesford
2020-04-20 20:12 ` [PR PATCH] [Closed]: " ahesford
2020-04-20 20:13 ` ahesford
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).