|
@@ -241,7 +241,7 @@ __uripecker__flt_uris() {
|
241
|
241
|
echo 'for uri in re.findall(os.environ["URI_RE"], sys.stdin.read()):'
|
242
|
242
|
echo ' print(uri)'
|
243
|
243
|
)
|
244
|
|
- URI_RE=$uri_re python3 -c "$py_code"
|
|
244
|
+ URI_RE=$uri_re $__URIPECKER_PYBIN -c "$py_code"
|
245
|
245
|
}
|
246
|
246
|
|
247
|
247
|
__uripecker__minimize() {
|
|
@@ -263,12 +263,26 @@ __uripecker__urlquote() {
|
263
|
263
|
local query=$1
|
264
|
264
|
debug -v query
|
265
|
265
|
#shellcheck disable=SC2028
|
266
|
|
- LC_ALL=en_US.UTF-8 python3 -c "$(
|
267
|
|
- echo 'import urllib.parse'
|
|
266
|
+ LC_ALL=en_US.UTF-8 $__URIPECKER_PYBIN -c "$(
|
|
267
|
+ echo "import $__URIPECKER_PYMOD"
|
268
|
268
|
echo 'import sys'
|
269
|
|
- echo 'print(urllib.parse.quote_plus(sys.argv[1]))'
|
|
269
|
+ echo "print($__URIPECKER_PYMOD.quote_plus(sys.argv[1]))"
|
270
|
270
|
)" "$query"
|
271
|
271
|
#FIXME: There should be proper way w/o touching LC_ALL
|
272
|
272
|
}
|
273
|
273
|
|
|
274
|
+__shellfu_uripecker__init() {
|
|
275
|
+ #
|
|
276
|
+ # See what python version is here
|
|
277
|
+ #
|
|
278
|
+ if python3 --version 2>/dev/null \
|
|
279
|
+ | grep -qF 'Python 3.'; then
|
|
280
|
+ __URIPECKER_PYBIN=python3
|
|
281
|
+ __URIPECKER_PYMOD=urllib.parse
|
|
282
|
+ else
|
|
283
|
+ __URIPECKER_PYBIN=python
|
|
284
|
+ __URIPECKER_PYMOD=urllib
|
|
285
|
+ fi
|
|
286
|
+}
|
|
287
|
+
|
274
|
288
|
#shellfu module-version=__MKIT_PROJ_VERSION__
|