diff options
author | ng0 <ng0@n0.is> | 2019-02-15 18:58:50 +0000 |
---|---|---|
committer | ng0 <ng0@n0.is> | 2019-02-15 18:58:50 +0000 |
commit | 5efd17d8d54edd201929f3a992ff6ceb20e676ce (patch) | |
tree | fadb3d661a9516fd2d713ccac3e26f92d9d3b4a3 | |
parent | c2d19c88745d16e5f2a33ad9e291a9d3ab6fa461 (diff) | |
download | gnunet-5efd17d8d54edd201929f3a992ff6ceb20e676ce.tar.gz gnunet-5efd17d8d54edd201929f3a992ff6ceb20e676ce.zip |
Fix bug reported by schanzen@ where bootstrap is not enough for our python2.7 script.
-rwxr-xr-x | bootstrap | 40 | ||||
-rw-r--r-- | src/util/Makefile.am | 7 | ||||
-rwxr-xr-x | src/util/gnunet-qr.py.in | 2 |
3 files changed, 6 insertions, 43 deletions
@@ -19,43 +19,3 @@ else | |||
19 | echo "*** No libtoolize (libtool) or libtool found, please install it ***" >&2; | 19 | echo "*** No libtoolize (libtool) or libtool found, please install it ***" >&2; |
20 | exit 1 | 20 | exit 1 |
21 | fi | 21 | fi |
22 | |||
23 | # autotools is being incredible stupid with multiple python versions | ||
24 | # what we do here is check for a functional python 2.7 which reports | ||
25 | # back to be a real python 2.7, then later on sed the location in | ||
26 | # the only python 2.7 file we keep around | ||
27 | # the rest of the build system can then be happy detecting 3.7 or | ||
28 | # higher | ||
29 | # this checks a range of names which is as annoying as what autotools | ||
30 | # is doing | ||
31 | # Since everything we could try is do too much work, we will assume | ||
32 | # that python2 OR python2.7 are the names for python 2.7. | ||
33 | # If your system diverges, please sed it accordingly! | ||
34 | echo "save python 2.7 location into src/util/python27_location" | ||
35 | #if existence python2 || existence python2.7; then | ||
36 | # echo command -v | ||
37 | python_version() | ||
38 | { | ||
39 | "$1" -c "print(__import__('sys').version)" | grep -Z "2.7" | cut -c1-3 | ||
40 | } | ||
41 | |||
42 | if existence python; then | ||
43 | if [ ! -z "${python_version} python" ]; then | ||
44 | loc1=$(command -v python) | ||
45 | echo "$loc1" >./src/util/python27_location | ||
46 | fi | ||
47 | elif existence python2; then | ||
48 | if [ ! -z "${python_version} python2" ]; then | ||
49 | loc2=$(command -v python2) | ||
50 | echo "$loc2" >./src/util/python27_location | ||
51 | fi | ||
52 | elif existence python2.7; then | ||
53 | if [ ! -z "${python_version} python2.7" ]; then | ||
54 | loc3=$(command -v python2.7) | ||
55 | echo "$loc3" >./src/util/python27_location | ||
56 | fi | ||
57 | else | ||
58 | echo "*** No python 2.7 binary found, please install it" >&2 | ||
59 | echo "*** for the optional gnunet-qr to work." >&2 | ||
60 | echo "*** Make sure to install a matching python future module." >&2 | ||
61 | fi | ||
diff --git a/src/util/Makefile.am b/src/util/Makefile.am index 1e82ec73a..0ba06f4bb 100644 --- a/src/util/Makefile.am +++ b/src/util/Makefile.am | |||
@@ -225,10 +225,13 @@ gnunet_timeout_SOURCES = \ | |||
225 | gnunet-timeout-w32.c | 225 | gnunet-timeout-w32.c |
226 | endif | 226 | endif |
227 | 227 | ||
228 | # This is horrible, but compared to the alternatives and the solution | ||
229 | # which preceded this it is a good compromise and good enough for one | ||
230 | # file. Everyone else is invited to patch it locally. | ||
228 | 231 | ||
229 | mypython27=$(shell cat $(top_srcdir)/src/util/python27_location) | 232 | xENV=$(shell which env) |
230 | 233 | ||
231 | do_subst = $(SED) -e 's,[@]PYTHON2[@],${mypython27},g' | 234 | do_subst = $(SED) -e 's,[@]ENV[@],${xENV},g' |
232 | 235 | ||
233 | gnunet-qr: gnunet-qr.py.in Makefile | 236 | gnunet-qr: gnunet-qr.py.in Makefile |
234 | $(do_subst) < $(top_srcdir)/src/util/gnunet-qr.py.in > gnunet-qr | 237 | $(do_subst) < $(top_srcdir)/src/util/gnunet-qr.py.in > gnunet-qr |
diff --git a/src/util/gnunet-qr.py.in b/src/util/gnunet-qr.py.in index 0d52bed53..ceed8bd77 100755 --- a/src/util/gnunet-qr.py.in +++ b/src/util/gnunet-qr.py.in | |||
@@ -1,4 +1,4 @@ | |||
1 | #!@PYTHON2@ | 1 | #!@ENV@ python2.7 |
2 | from __future__ import print_function | 2 | from __future__ import print_function |
3 | from builtins import str | 3 | from builtins import str |
4 | import sys | 4 | import sys |