From c8269e5a6b7db18bb27c831a16e4ed5c8a03763c Mon Sep 17 00:00:00 2001 From: Markus Frosch Date: Fri, 17 Apr 2020 17:53:38 +0200 Subject: [PATCH 1/2] Fix some compat issues for Python 2.7 --- terminatorlib/terminal.py | 7 +++++-- terminatorlib/util.py | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index 2eabc446..eab7fa9a 100644 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -10,7 +10,10 @@ from gi.repository import GLib, GObject, Pango, Gtk, Gdk gi.require_version('Vte', '2.91') # vte-0.38 (gnome-3.14) from gi.repository import Vte import subprocess -import urllib.request, urllib.parse, urllib.error +try: + from urllib.parse import unquote as urlunquote +except ImportError: + from urllib import unquote as urlunquote from .util import dbg, err, spawn_new_terminator, make_uuid, manual_lookup, display_manager from . import util @@ -1120,7 +1123,7 @@ class Terminal(Gtk.VBox): str='' for fname in txt_lines[:-1]: dbg('drag data fname: %s' % fname) - fname = "'%s'" % urllib.parse.unquote(fname[7:].replace("'", + fname = "'%s'" % urlunquote(fname[7:].replace("'", '\'\\\'\'')) str += fname + ' ' txt=str diff --git a/terminatorlib/util.py b/terminatorlib/util.py index 75e78ac4..e45f38f2 100644 --- a/terminatorlib/util.py +++ b/terminatorlib/util.py @@ -15,6 +15,8 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """Terminator.util - misc utility functions""" +from __future__ import print_function + import sys import cairo import os @@ -24,6 +26,7 @@ import uuid import subprocess import gi + try: gi.require_version('Gtk','3.0') from gi.repository import Gtk, Gdk From c7e466dbfe05e0a98da15a5ee45c489fe536448f Mon Sep 17 00:00:00 2001 From: Markus Frosch Date: Fri, 17 Apr 2020 18:20:43 +0200 Subject: [PATCH 2/2] ci: Enable Python 2.7 --- .github/workflows/python.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index aea972da..e97a0338 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -13,14 +13,14 @@ jobs: strategy: matrix: python: - #- '2.7' + - '2.7' - '3.6' - '3.7' - '3.8' steps: - uses: actions/checkout@v2 - + - name: Set up Python ${{ matrix.python }} uses: actions/setup-python@v1 with: