From b7e056853917e0c624e28ef2273440c3187f788c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lorenz=20H=C3=BCdepohl?= <lorenz.huedepohl@rzg.mpg.de>
Date: Thu, 31 Oct 2019 10:13:47 +0100
Subject: [PATCH] Support Python 2 for a bit more

But the end is coming!
---
 mpcdf_common.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/mpcdf_common.py b/mpcdf_common.py
index 3ce2cf9..936c5a9 100644
--- a/mpcdf_common.py
+++ b/mpcdf_common.py
@@ -58,14 +58,19 @@ def check_for_update():
     else:
         setattr(sys.modules["mpcdf_common"], "checked_for_updates", 1)
 
+    if (sys.version_info > (3, 0)):
+        set_encoding = {"encoding" : "utf-8"}
+    else:
+        set_encoding = {}
+
     plugin_dir = os.path.dirname(os.path.realpath(__file__))
     git_dir = os.path.join(plugin_dir, ".git")
-    local_rev = check_output(["git", "--git-dir", git_dir, "rev-parse", "HEAD"], encoding="utf-8").strip()
+    local_rev = check_output(["git", "--git-dir", git_dir, "rev-parse", "HEAD"], **set_encoding).strip()
 
     url = "https://gitlab.mpcdf.mpg.de/mpcdf/osc-plugins.git"
 
     def update_server_rev():
-        server_rev, _ = check_output(["git", "ls-remote", url, "master"], encoding="utf-8").split(maxsplit=1)
+        server_rev, _ = check_output(["git", "ls-remote", url, "master"], **set_encoding).split(maxsplit=1)
         with open(rev_file, "w") as fd:
             fd.write(server_rev)
 
-- 
GitLab