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

+ 4
- 4
packaging/template.spec View File

12
 BuildArch:  noarch
12
 BuildArch:  noarch
13
 BuildRequires: %shellfu_req
13
 BuildRequires: %shellfu_req
14
 BuildRequires: perl
14
 BuildRequires: perl
15
-BuildRequires: python
16
-BuildRequires: python-libs
15
+BuildRequires: python3
16
+BuildRequires: python3-libs
17
 BuildRequires: shellfu-bash-pretty
17
 BuildRequires: shellfu-bash-pretty
18
 
18
 
19
 Requires: %shellfu_req
19
 Requires: %shellfu_req
20
 Requires: perl
20
 Requires: perl
21
-Requires: python
22
-Requires: python-libs
21
+Requires: python3
22
+Requires: python3-libs
23
 Requires: shellfu-bash
23
 Requires: shellfu-bash
24
 Requires: shellfu-bash-pretty
24
 Requires: shellfu-bash-pretty
25
 %description
25
 %description

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

239
         echo 'import sys'
239
         echo 'import sys'
240
         echo
240
         echo
241
         echo 'for uri in re.findall(os.environ["URI_RE"], sys.stdin.read()):'
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
 __uripecker__minimize() {
247
 __uripecker__minimize() {
263
     local query=$1
263
     local query=$1
264
     debug -v query
264
     debug -v query
265
     #shellcheck disable=SC2028
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
         echo 'import sys'
268
         echo 'import sys'
269
-        echo 'print urllib.quote_plus(sys.argv[1])'
269
+        echo 'print(urllib.parse.quote_plus(sys.argv[1]))'
270
     )" "$query"
270
     )" "$query"
271
+    #FIXME: There should be proper way w/o touching LC_ALL
271
 }
272
 }
272
 
273
 
273
 #shellfu module-version=__MKIT_PROJ_VERSION__
274
 #shellfu module-version=__MKIT_PROJ_VERSION__