diff options
author | ng0 <ng0@n0.is> | 2019-02-14 16:41:09 +0000 |
---|---|---|
committer | ng0 <ng0@n0.is> | 2019-02-14 16:41:09 +0000 |
commit | 783ac3513030b6006d117f156cfc068148757bcf (patch) | |
tree | 8d0e2cce1dc0a591c4c15ec0299d00dbfaac571f | |
parent | b54371bd5ca3d86e7e8383149975fdc31b14d0a7 (diff) | |
download | gnunet-783ac3513030b6006d117f156cfc068148757bcf.tar.gz gnunet-783ac3513030b6006d117f156cfc068148757bcf.zip |
Switch to python3.7 (integration-tests incomplete), continue using python2.7 for gnunet-qr with an incredible annoying workaround for autotools inability to deal with 2 major python versions at the same time
Signed-off-by: ng0 <ng0@n0.is>
-rwxr-xr-x | bootstrap | 40 | ||||
-rw-r--r-- | configure.ac | 13 | ||||
-rw-r--r-- | src/util/.gitignore | 1 | ||||
-rw-r--r-- | src/util/Makefile.am | 4 | ||||
-rwxr-xr-x | src/util/gnunet-qr.py.in | 2 |
5 files changed, 53 insertions, 7 deletions
@@ -19,3 +19,43 @@ 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/configure.ac b/configure.ac index f53d65006..5f10599be 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -1,5 +1,5 @@ | |||
1 | # This file is part of GNUnet. | 1 | # This file is part of GNUnet. |
2 | # (C) 2001--2018 GNUnet e.V. | 2 | # (C) 2001--2019 GNUnet e.V. |
3 | # | 3 | # |
4 | # GNUnet is free software: you can redistribute it and/or modify it | 4 | # GNUnet is free software: you can redistribute it and/or modify it |
5 | # under the terms of the GNU Affero General Public License as published | 5 | # under the terms of the GNU Affero General Public License as published |
@@ -206,6 +206,13 @@ AM_CONDITIONAL(HAVE_SSH_BINARY, $VAR_SSH_BINARY) | |||
206 | AM_CONDITIONAL(HAVE_SSH_KEY, ssh -D 12345 -o "BatchMode yes" -o "UserKnownHostsFile /tmp/gnunet_test_cosks_ssh_garbage" -o "StrictHostKeyChecking no" 127.0.0.1 echo -n) | 206 | AM_CONDITIONAL(HAVE_SSH_KEY, ssh -D 12345 -o "BatchMode yes" -o "UserKnownHostsFile /tmp/gnunet_test_cosks_ssh_garbage" -o "StrictHostKeyChecking no" 127.0.0.1 echo -n) |
207 | rm -f /tmp/gnunet_test_cosks_ssh_garbage | 207 | rm -f /tmp/gnunet_test_cosks_ssh_garbage |
208 | 208 | ||
209 | # autotools' m4 for python has no maximum version! | ||
210 | # python3.7 for tests | ||
211 | m4_define_default([_AM_PYTHON_INTERPRETER_LIST],[python3 python3.7 python]) | ||
212 | AM_PATH_PYTHON([3.7],, [:]) | ||
213 | AC_SUBST([PYTHON]) | ||
214 | AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :]) | ||
215 | |||
209 | # iptables is a soft requirement to run tests | 216 | # iptables is a soft requirement to run tests |
210 | AC_PATH_TARGET_TOOL(VAR_IPTABLES_BINARY, iptables, false) | 217 | AC_PATH_TARGET_TOOL(VAR_IPTABLES_BINARY, iptables, false) |
211 | 218 | ||
@@ -1208,10 +1215,6 @@ AM_CONDITIONAL(HAVE_JSON, [test x$jansson = x1]) | |||
1208 | # restore LIBS | 1215 | # restore LIBS |
1209 | LIBS=$SAVE_LIBS | 1216 | LIBS=$SAVE_LIBS |
1210 | 1217 | ||
1211 | # check for python & pexpect (used for some testcases only) | ||
1212 | AM_PATH_PYTHON([2.6],, [:]) | ||
1213 | AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != :]) | ||
1214 | |||
1215 | # check for gettext | 1218 | # check for gettext |
1216 | AM_GNU_GETTEXT([external]) | 1219 | AM_GNU_GETTEXT([external]) |
1217 | AM_GNU_GETTEXT_VERSION([0.18.1]) | 1220 | AM_GNU_GETTEXT_VERSION([0.18.1]) |
diff --git a/src/util/.gitignore b/src/util/.gitignore index 7b190ca76..dfa6c7947 100644 --- a/src/util/.gitignore +++ b/src/util/.gitignore | |||
@@ -73,3 +73,4 @@ test_hexcoder | |||
73 | test_regex | 73 | test_regex |
74 | test_tun | 74 | test_tun |
75 | gnunet-timeout | 75 | gnunet-timeout |
76 | python27_location | ||
diff --git a/src/util/Makefile.am b/src/util/Makefile.am index fd00b077d..1e82ec73a 100644 --- a/src/util/Makefile.am +++ b/src/util/Makefile.am | |||
@@ -226,7 +226,9 @@ gnunet_timeout_SOURCES = \ | |||
226 | endif | 226 | endif |
227 | 227 | ||
228 | 228 | ||
229 | do_subst = $(SED) -e 's,[@]PYTHON[@],$(PYTHON),g' | 229 | mypython27=$(shell cat $(top_srcdir)/src/util/python27_location) |
230 | |||
231 | do_subst = $(SED) -e 's,[@]PYTHON2[@],${mypython27},g' | ||
230 | 232 | ||
231 | gnunet-qr: gnunet-qr.py.in Makefile | 233 | gnunet-qr: gnunet-qr.py.in Makefile |
232 | $(do_subst) < $(top_srcdir)/src/util/gnunet-qr.py.in > gnunet-qr | 234 | $(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 6c9d208f7..0d52bed53 100755 --- a/src/util/gnunet-qr.py.in +++ b/src/util/gnunet-qr.py.in | |||
@@ -1,4 +1,4 @@ | |||
1 | #!@PYTHON@ | 1 | #!@PYTHON2@ |
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 |