Browse Source

Use Python 3 for snippets

Fedora 28 already issues deprecation warnings, which disrupt tests.
Alois Mahdal 6 years ago
parent
commit
47b1551fd9
3 changed files with 14 additions and 13 deletions
  1. 4
    4
      packaging/debian/control
  2. 4
    4
      packaging/template.spec
  3. 6
    5
      src/uripecker.sh.skel

+ 4
- 4
packaging/debian/control View File

@@ -7,8 +7,8 @@ Standards-Version: 3.9.2
7 7
 Build-Depends:
8 8
  debhelper (>= 9),
9 9
  python,
10
- libpython2.7-minimal,
11
- libpython2.7-stdlib,
10
+ libpython3.5-minimal,
11
+ libpython3.5-stdlib,
12 12
  shellfu (>= 0.10),
13 13
  shellfu (<< 0.11),
14 14
  shellfu-bash,
@@ -18,8 +18,8 @@ Package: __MKIT_PROJ_PKGNAME__
18 18
 Architecture: all
19 19
 Depends:
20 20
  python,
21
- libpython2.7-minimal,
22
- libpython2.7-stdlib,
21
+ libpython3.5-minimal,
22
+ libpython3.5-stdlib,
23 23
  shellfu (>= 0.10),
24 24
  shellfu (<< 0.11),
25 25
  shellfu-bash,

+ 4
- 4
packaging/template.spec View File

@@ -12,14 +12,14 @@ Source0:    %{name}-%{version}.tar.gz
12 12
 BuildArch:  noarch
13 13
 BuildRequires: %shellfu_req
14 14
 BuildRequires: perl
15
-BuildRequires: python
16
-BuildRequires: python-libs
15
+BuildRequires: python3
16
+BuildRequires: python3-libs
17 17
 BuildRequires: shellfu-bash-pretty
18 18
 
19 19
 Requires: %shellfu_req
20 20
 Requires: perl
21
-Requires: python
22
-Requires: python-libs
21
+Requires: python3
22
+Requires: python3-libs
23 23
 Requires: shellfu-bash
24 24
 Requires: shellfu-bash-pretty
25 25
 %description

+ 6
- 5
src/uripecker.sh.skel View File

@@ -239,9 +239,9 @@ __uripecker__flt_uris() {
239 239
         echo 'import sys'
240 240
         echo
241 241
         echo 'for uri in re.findall(os.environ["URI_RE"], sys.stdin.read()):'
242
-        echo '    print uri'
242
+        echo '    print(uri)'
243 243
     )
244
-    URI_RE=$uri_re python -c "$py_code"
244
+    URI_RE=$uri_re python3 -c "$py_code"
245 245
 }
246 246
 
247 247
 __uripecker__minimize() {
@@ -263,11 +263,12 @@ __uripecker__urlquote() {
263 263
     local query=$1
264 264
     debug -v query
265 265
     #shellcheck disable=SC2028
266
-    python -c "$(
267
-        echo 'import urllib'
266
+    LC_ALL=en_US.UTF-8 python3 -c "$(
267
+        echo 'import urllib.parse'
268 268
         echo 'import sys'
269
-        echo 'print urllib.quote_plus(sys.argv[1])'
269
+        echo 'print(urllib.parse.quote_plus(sys.argv[1]))'
270 270
     )" "$query"
271
+    #FIXME: There should be proper way w/o touching LC_ALL
271 272
 }
272 273
 
273 274
 #shellfu module-version=__MKIT_PROJ_VERSION__