aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorng0 <ng0@n0.is>2019-02-26 08:35:45 +0000
committerng0 <ng0@n0.is>2019-02-26 08:35:45 +0000
commit5f80de3fbc0c4b43fb93d0ef4460aea16b2c78e0 (patch)
tree74e83f28ea8198bb1e934a770a6f082bd3ea7984
parent689614a7e51f4fda776e99aa5892811fa5923b2d (diff)
downloadgnunet-5f80de3fbc0c4b43fb93d0ef4460aea16b2c78e0.tar.gz
gnunet-5f80de3fbc0c4b43fb93d0ef4460aea16b2c78e0.zip
Proposed fix for https://bugs.gnunet.org/view.php?id=5611
-rw-r--r--src/util/Makefile.am27
-rwxr-xr-xsrc/util/gnunet-qr.in46
-rwxr-xr-xsrc/util/gnunet-qr.py (renamed from src/util/gnunet-qr.py.in)1
3 files changed, 56 insertions, 18 deletions
diff --git a/src/util/Makefile.am b/src/util/Makefile.am
index d1aa8aa9b..7041004ac 100644
--- a/src/util/Makefile.am
+++ b/src/util/Makefile.am
@@ -204,8 +204,15 @@ libexec_PROGRAMS = \
204 gnunet-timeout \ 204 gnunet-timeout \
205 $(W32CONSOLEHELPER) 205 $(W32CONSOLEHELPER)
206 206
207do_subst = $(SED) -e 's,[@]PREFIX[@],$(PREFIX),g'
208
209gnunet-qr: gnunet-qr.in Makefile
210 $(do_subst) < $(srcdir)/gnunet-qr.in > gnunet-qr
211 chmod +x gnunet-qr
212
207bin_SCRIPTS =\ 213bin_SCRIPTS =\
208 gnunet-qr 214 gnunet-qr \
215 gnunet-qr.py
209 216
210bin_PROGRAMS = \ 217bin_PROGRAMS = \
211 gnunet-resolver \ 218 gnunet-resolver \
@@ -236,21 +243,6 @@ gnunet_timeout_SOURCES = \
236 gnunet-timeout-w32.c 243 gnunet-timeout-w32.c
237endif 244endif
238 245
239# This is horrible, but compared to the alternatives and the solution
240# which preceded this it is a good compromise and good enough for one
241# file. Everyone else is invited to patch it locally.
242# In case someone reads this file and is wondering about the
243# assignment operator below, it's explained here:
244# https://lists.gnu.org/archive/html/make-w32/2013-10/msg00021.html
245
246xENV != which env
247
248do_subst = $(SED) -e 's,[@]ENV[@],${xENV},g'
249
250gnunet-qr: gnunet-qr.py.in Makefile
251 $(do_subst) < $(top_srcdir)/src/util/gnunet-qr.py.in > gnunet-qr
252 chmod +x gnunet-qr
253
254gnunet_service_resolver_SOURCES = \ 246gnunet_service_resolver_SOURCES = \
255 gnunet-service-resolver.c 247 gnunet-service-resolver.c
256gnunet_service_resolver_LDADD = \ 248gnunet_service_resolver_LDADD = \
@@ -675,4 +667,5 @@ EXTRA_DIST = \
675 test_resolver_api_data.conf \ 667 test_resolver_api_data.conf \
676 test_service_data.conf \ 668 test_service_data.conf \
677 test_speedup_data.conf \ 669 test_speedup_data.conf \
678 gnunet-qr.py.in 670 gnunet-qr.py \
671 gnunet-qr.in
diff --git a/src/util/gnunet-qr.in b/src/util/gnunet-qr.in
new file mode 100755
index 000000000..5e7a285ac
--- /dev/null
+++ b/src/util/gnunet-qr.in
@@ -0,0 +1,46 @@
1#!/bin/sh
2#
3# From curl's buildconf, making this script subject to the
4# curl license: https://curl.haxx.se/docs/copyright.html
5# Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
6# Copyright (C) 2019 GNUnet e.V.
7
8# findtool works like which without relying on which (which is a problem
9# for some limited shells.
10findtool(){
11 file="$1"
12
13 if { echo "$file" | grep "/" >/dev/null 2>&1; } then
14 # when file is given with a path check it first
15 if test -f "$file"; then
16 echo "$file"
17 return
18 fi
19 fi
20
21 old_IFS=$IFS; IFS=':'
22 for path in $PATH
23 do
24 IFS=$old_IFS
25 # echo "checks for $file in $path" >&2
26 if test "$path" -a "$path" != '.' -a -f "$path/$file"; then
27 echo "$path/$file"
28 return
29 fi
30 done
31 IFS=$old_IFS
32}
33
34# end curl licensed code
35pythonize=`findtool python2.7 2>/dev/null`
36if test ! -x "$pythonize"; then
37 pythonize=`findtool ${PYTHON2:-python2.7}`
38fi
39
40if test -z "$pythonize"; then
41 echo "ERROR: python2.7 not found."
42 echo " You need python2.7 installed."
43 exit 1
44fi
45
46${pythonize} @PREFIX@/bin/gnunet-qr.py || echo "ERROR: python2.7 or future not found" && exit 1
diff --git a/src/util/gnunet-qr.py.in b/src/util/gnunet-qr.py
index ceed8bd77..bf35b3a7e 100755
--- a/src/util/gnunet-qr.py.in
+++ b/src/util/gnunet-qr.py
@@ -1,4 +1,3 @@
1#!@ENV@ python2.7
2from __future__ import print_function 1from __future__ import print_function
3from builtins import str 2from builtins import str
4import sys 3import sys