Blame SOURCES/port-to-python2.patch

a233c0
From 1bda0910b4d8b05dfa94732d4bb0795621d4970f Mon Sep 17 00:00:00 2001
a233c0
From: Carlos Soriano <csoriano@redhat.com>
a233c0
Date: Thu, 14 Jun 2018 11:51:06 +0200
a233c0
Subject: [PATCH 2/3] general: Port to python2
a233c0
a233c0
RHEL 7.6 doesn't have python3...
a233c0
---
a233c0
 gnome-tweak-tool-lid-inhibitor                |  2 +-
a233c0
 gnome-tweaks                                  |  2 +-
a233c0
 gtweak/app.py                                 |  1 +
a233c0
 gtweak/egowrapper.py                          |  1 +
a233c0
 gtweak/gsettings.py                           |  1 +
a233c0
 gtweak/gshellwrapper.py                       |  3 ++-
a233c0
 gtweak/gtksettings.py                         | 13 +++++++++++--
a233c0
 gtweak/tweakmodel.py                          |  5 +++--
a233c0
 gtweak/tweaks/tweak_group_appearance.py       |  1 +
a233c0
 gtweak/tweaks/tweak_group_desktop.py          |  1 +
a233c0
 gtweak/tweaks/tweak_group_font.py             |  1 +
a233c0
 gtweak/tweaks/tweak_group_keymouse.py         |  1 +
a233c0
 gtweak/tweaks/tweak_group_power.py            |  1 +
a233c0
 gtweak/tweaks/tweak_group_shell_extensions.py |  5 +++--
a233c0
 gtweak/tweaks/tweak_group_sound.py            |  1 +
a233c0
 gtweak/tweaks/tweak_group_startup.py          |  5 ++++-
a233c0
 gtweak/tweaks/tweak_group_test.py             |  3 +++
a233c0
 gtweak/tweaks/tweak_group_top_bar.py          |  3 ++-
a233c0
 gtweak/tweaks/tweak_group_windows.py          |  1 +
a233c0
 gtweak/tweaks/tweak_group_workspaces.py       |  3 ++-
a233c0
 gtweak/tweaks/tweak_group_xkb.py              |  5 +++--
a233c0
 gtweak/tweaks/tweak_wacom.py                  |  9 +++++----
a233c0
 gtweak/tweakview.py                           |  5 +++--
a233c0
 gtweak/utils.py                               | 11 ++++++++---
a233c0
 gtweak/widgets.py                             |  1 +
a233c0
 meson-postinstall.py                          |  4 ++--
a233c0
 meson.build                                   |  3 +--
a233c0
 27 files changed, 65 insertions(+), 27 deletions(-)
a233c0
a233c0
diff --git a/gnome-tweak-tool-lid-inhibitor b/gnome-tweak-tool-lid-inhibitor
a233c0
index f9d18db..499e9eb 100755
a233c0
--- a/gnome-tweak-tool-lid-inhibitor
a233c0
+++ b/gnome-tweak-tool-lid-inhibitor
a233c0
@@ -1,4 +1,4 @@
a233c0
-#!/usr/bin/env python3
a233c0
+#!/usr/bin/env python
a233c0
 # SPDX-License-Identifier: GPL-3.0+
a233c0
 # License-Filename: LICENSES/GPL-3.0
a233c0
 
a233c0
diff --git a/gnome-tweaks b/gnome-tweaks
a233c0
index 596d8ab..038bb9d 100755
a233c0
--- a/gnome-tweaks
a233c0
+++ b/gnome-tweaks
a233c0
@@ -1,4 +1,4 @@
a233c0
-#!/usr/bin/env python3
a233c0
+#!/usr/bin/env python
a233c0
 # SPDX-License-Identifier: GPL-3.0+
a233c0
 # License-Filename: LICENSES/GPL-3.0
a233c0
 
a233c0
diff --git a/gtweak/app.py b/gtweak/app.py
a233c0
index bc5b5f4..03dc99d 100644
a233c0
--- a/gtweak/app.py
a233c0
+++ b/gtweak/app.py
a233c0
@@ -1,3 +1,4 @@
a233c0
+# -*- coding: utf-8 -*-
a233c0
 # Copyright (c) 2011 John Stowers
a233c0
 # SPDX-License-Identifier: GPL-3.0+
a233c0
 # License-Filename: LICENSES/GPL-3.0
a233c0
diff --git a/gtweak/egowrapper.py b/gtweak/egowrapper.py
a233c0
index 7a60f71..11caee3 100644
a233c0
--- a/gtweak/egowrapper.py
a233c0
+++ b/gtweak/egowrapper.py
a233c0
@@ -1,3 +1,4 @@
a233c0
+# -*- coding: utf-8 -*-
a233c0
 # Copyright (c) 2011 John Stowers
a233c0
 # SPDX-License-Identifier: GPL-3.0+
a233c0
 # License-Filename: LICENSES/GPL-3.0
a233c0
diff --git a/gtweak/gsettings.py b/gtweak/gsettings.py
a233c0
index e0116e9..96d58e3 100644
a233c0
--- a/gtweak/gsettings.py
a233c0
+++ b/gtweak/gsettings.py
a233c0
@@ -1,3 +1,4 @@
a233c0
+# -*- coding: utf-8 -*-
a233c0
 # Copyright (c) 2011 John Stowers
a233c0
 # SPDX-License-Identifier: GPL-3.0+
a233c0
 # License-Filename: LICENSES/GPL-3.0
a233c0
diff --git a/gtweak/gshellwrapper.py b/gtweak/gshellwrapper.py
a233c0
index 0e4a49b..d654f88 100644
a233c0
--- a/gtweak/gshellwrapper.py
a233c0
+++ b/gtweak/gshellwrapper.py
a233c0
@@ -1,3 +1,4 @@
a233c0
+# -*- coding: utf-8 -*-
a233c0
 # Copyright (c) 2011 John Stowers
a233c0
 # SPDX-License-Identifier: GPL-3.0+
a233c0
 # License-Filename: LICENSES/GPL-3.0
a233c0
@@ -164,7 +165,7 @@ class GnomeShellFactory:
a233c0
         try:
a233c0
             proxy = _ShellProxy()
a233c0
             settings = GSettingsSetting("org.gnome.shell")
a233c0
-            v = list(map(int, proxy.version.split(".")))
a233c0
+            v = map(int, proxy.version.split("."))
a233c0
 
a233c0
             if v >= [3, 5, 0]:
a233c0
                 self.shell = GnomeShell36(proxy, settings)
a233c0
diff --git a/gtweak/gtksettings.py b/gtweak/gtksettings.py
a233c0
index ce09842..8d557b2 100644
a233c0
--- a/gtweak/gtksettings.py
a233c0
+++ b/gtweak/gtksettings.py
a233c0
@@ -1,9 +1,11 @@
a233c0
+# -*- coding: utf-8 -*-
a233c0
 # Copyright (c) 2012 Cosimo Cecchi
a233c0
 # SPDX-License-Identifier: GPL-3.0+
a233c0
 # License-Filename: LICENSES/GPL-3.0
a233c0
 
a233c0
 import os.path
a233c0
 import logging
a233c0
+import errno
a233c0
 
a233c0
 from gi.repository import GLib
a233c0
 
a233c0
@@ -18,7 +20,14 @@ class GtkSettingsManager:
a233c0
         self._path = os.path.join(GLib.get_user_config_dir(),
a233c0
                                   "gtk-" + version,
a233c0
                                   "settings.ini")
a233c0
-        os.makedirs(os.path.dirname(self._path), exist_ok=True)
a233c0
+        try:
a233c0
+            os.makedirs(os.path.dirname(self._path))
a233c0
+        except OSError, e:
a233c0
+            if e.errno is not errno.EEXIST:
a233c0
+                raise
a233c0
+        except:
a233c0
+            raise
a233c0
+
a233c0
 
a233c0
     def _get_keyfile(self):
a233c0
         keyfile = None
a233c0
@@ -47,4 +56,4 @@ class GtkSettingsManager:
a233c0
             data = keyfile.to_data()
a233c0
             GLib.file_set_contents(self._path, data[0].encode())
a233c0
         except:
a233c0
-            raise
a233c0
+            raise
a233c0
\ No newline at end of file
a233c0
diff --git a/gtweak/tweakmodel.py b/gtweak/tweakmodel.py
a233c0
index 2e9fb16..f8a9c18 100644
a233c0
--- a/gtweak/tweakmodel.py
a233c0
+++ b/gtweak/tweakmodel.py
a233c0
@@ -1,3 +1,4 @@
a233c0
+# -*- coding: utf-8 -*-
a233c0
 # Copyright (c) 2011 John Stowers
a233c0
 # SPDX-License-Identifier: GPL-3.0+
a233c0
 # License-Filename: LICENSES/GPL-3.0
a233c0
@@ -66,7 +67,7 @@ class TweakGroup(object):
a233c0
 
a233c0
 class TweakModel(Gtk.ListStore):
a233c0
     (COLUMN_NAME,
a233c0
-     COLUMN_TWEAK) = list(range(2))
a233c0
+     COLUMN_TWEAK) = range(2)
a233c0
 
a233c0
     def __init__(self):
a233c0
         super(TweakModel, self).__init__(str, object)
a233c0
@@ -140,4 +141,4 @@ class TweakModel(Gtk.ListStore):
a233c0
         return tweaks, groups
a233c0
 
a233c0
     def get_tweakgroup_iter(self, name):
a233c0
-        return self._tweak_group_iters[name]
a233c0
+        return self._tweak_group_iters[name]
a233c0
\ No newline at end of file
a233c0
diff --git a/gtweak/tweaks/tweak_group_appearance.py b/gtweak/tweaks/tweak_group_appearance.py
a233c0
index ff78735..e8b40a7 100644
a233c0
--- a/gtweak/tweaks/tweak_group_appearance.py
a233c0
+++ b/gtweak/tweaks/tweak_group_appearance.py
a233c0
@@ -1,3 +1,4 @@
a233c0
+# -*- coding: utf-8 -*-
a233c0
 # Copyright (c) 2011 John Stowers
a233c0
 # SPDX-License-Identifier: GPL-3.0+
a233c0
 # License-Filename: LICENSES/GPL-3.0
a233c0
diff --git a/gtweak/tweaks/tweak_group_desktop.py b/gtweak/tweaks/tweak_group_desktop.py
a233c0
index f55c696..d7239bd 100644
a233c0
--- a/gtweak/tweaks/tweak_group_desktop.py
a233c0
+++ b/gtweak/tweaks/tweak_group_desktop.py
a233c0
@@ -1,3 +1,4 @@
a233c0
+# -*- coding: utf-8 -*-
a233c0
 # Copyright (c) 2011 John Stowers
a233c0
 # SPDX-License-Identifier: GPL-3.0+
a233c0
 # License-Filename: LICENSES/GPL-3.0
a233c0
diff --git a/gtweak/tweaks/tweak_group_font.py b/gtweak/tweaks/tweak_group_font.py
a233c0
index 43f4d09..89986b6 100644
a233c0
--- a/gtweak/tweaks/tweak_group_font.py
a233c0
+++ b/gtweak/tweaks/tweak_group_font.py
a233c0
@@ -1,3 +1,4 @@
a233c0
+# -*- coding: utf-8 -*-
a233c0
 # Copyright (c) 2011 John Stowers
a233c0
 # SPDX-License-Identifier: GPL-3.0+
a233c0
 # License-Filename: LICENSES/GPL-3.0
a233c0
diff --git a/gtweak/tweaks/tweak_group_keymouse.py b/gtweak/tweaks/tweak_group_keymouse.py
a233c0
index 577d5cc..9553566 100644
a233c0
--- a/gtweak/tweaks/tweak_group_keymouse.py
a233c0
+++ b/gtweak/tweaks/tweak_group_keymouse.py
a233c0
@@ -1,3 +1,4 @@
a233c0
+# -*- coding: utf-8 -*-
a233c0
 # Copyright (c) 2011 John Stowers
a233c0
 # SPDX-License-Identifier: GPL-3.0+
a233c0
 # License-Filename: LICENSES/GPL-3.0
a233c0
diff --git a/gtweak/tweaks/tweak_group_power.py b/gtweak/tweaks/tweak_group_power.py
a233c0
index 305877f..b6c82c5 100644
a233c0
--- a/gtweak/tweaks/tweak_group_power.py
a233c0
+++ b/gtweak/tweaks/tweak_group_power.py
a233c0
@@ -1,3 +1,4 @@
a233c0
+# -*- coding: utf-8 -*-
a233c0
 # Copyright (c) 2011 John Stowers
a233c0
 # SPDX-License-Identifier: GPL-3.0+
a233c0
 # License-Filename: LICENSES/GPL-3.0
a233c0
diff --git a/gtweak/tweaks/tweak_group_shell_extensions.py b/gtweak/tweaks/tweak_group_shell_extensions.py
a233c0
index 8ef4bf8..82c754b 100644
a233c0
--- a/gtweak/tweaks/tweak_group_shell_extensions.py
a233c0
+++ b/gtweak/tweaks/tweak_group_shell_extensions.py
a233c0
@@ -1,3 +1,4 @@
a233c0
+# -*- coding: utf-8 -*-
a233c0
 # SPDX-License-Identifier: GPL-3.0+
a233c0
 # License-Filename: LICENSES/GPL-3.0
a233c0
 
a233c0
@@ -219,7 +220,7 @@ class ShellExtensionTweakGroup(ListBoxTweakGroup):
a233c0
             ego = ExtensionsDotGnomeDotOrg(version)
a233c0
             try:
a233c0
                 #add a tweak for each installed extension
a233c0
-                extensions = sorted(list(shell.list_extensions().values()), key=itemgetter("name"))
a233c0
+                extensions = sorted(shell.list_extensions().values(), key=itemgetter("name"))
a233c0
                 for extension in extensions:
a233c0
                     try:
a233c0
                         extension_widget = _ShellExtensionTweak(shell, extension, size_group=sg)
a233c0
@@ -280,4 +281,4 @@ class ShellExtensionTweakGroup(ListBoxTweakGroup):
a233c0
 
a233c0
 TWEAK_GROUPS = [
a233c0
         ShellExtensionTweakGroup(),
a233c0
-]
a233c0
+]
a233c0
\ No newline at end of file
a233c0
diff --git a/gtweak/tweaks/tweak_group_sound.py b/gtweak/tweaks/tweak_group_sound.py
a233c0
index 78705ef..cd35f58 100644
a233c0
--- a/gtweak/tweaks/tweak_group_sound.py
a233c0
+++ b/gtweak/tweaks/tweak_group_sound.py
a233c0
@@ -1,3 +1,4 @@
a233c0
+# -*- coding: utf-8 -*-
a233c0
 # Copyright (c) 2017 Canonical
a233c0
 # SPDX-License-Identifier: GPL-3.0+
a233c0
 # License-Filename: LICENSES/GPL-3.0
a233c0
diff --git a/gtweak/tweaks/tweak_group_startup.py b/gtweak/tweaks/tweak_group_startup.py
a233c0
index 05f7022..ba1288c 100644
a233c0
--- a/gtweak/tweaks/tweak_group_startup.py
a233c0
+++ b/gtweak/tweaks/tweak_group_startup.py
a233c0
@@ -1,7 +1,10 @@
a233c0
+# -*- coding: utf-8 -*-
a233c0
 # Copyright (c) 2011 John Stowers
a233c0
 # SPDX-License-Identifier: GPL-3.0+
a233c0
 # License-Filename: LICENSES/GPL-3.0
a233c0
 
a233c0
+from __future__ import print_function
a233c0
+
a233c0
 import os.path
a233c0
 import subprocess
a233c0
 import logging
a233c0
@@ -339,7 +342,7 @@ class AutostartListBoxTweakGroup(ListBoxTweakGroup):
a233c0
                     str(os.getuid()),'-o','cmd'],
a233c0
                     stdout=subprocess.PIPE)
a233c0
         out = cmd.communicate()[0]
a233c0
-        for l in out.decode('utf8').split('\n'):
a233c0
+        for l in out.split('\n'):
a233c0
             exe = l.split(' ')[0]
a233c0
             if exe and exe[0] != '[': #kernel process
a233c0
                 exes.append( os.path.basename(exe) )
a233c0
diff --git a/gtweak/tweaks/tweak_group_test.py b/gtweak/tweaks/tweak_group_test.py
a233c0
index f056111..004815b 100644
a233c0
--- a/gtweak/tweaks/tweak_group_test.py
a233c0
+++ b/gtweak/tweaks/tweak_group_test.py
a233c0
@@ -1,7 +1,10 @@
a233c0
+# -*- coding: utf-8 -*-
a233c0
 # Copyright (c) 2011 John Stowers
a233c0
 # SPDX-License-Identifier: GPL-3.0+
a233c0
 # License-Filename: LICENSES/GPL-3.0
a233c0
 
a233c0
+from __future__ import print_function
a233c0
+
a233c0
 from gi.repository import Gtk, Gdk
a233c0
 
a233c0
 from gtweak.tweakmodel import Tweak
a233c0
diff --git a/gtweak/tweaks/tweak_group_top_bar.py b/gtweak/tweaks/tweak_group_top_bar.py
a233c0
index 0979720..05a3d31 100644
a233c0
--- a/gtweak/tweaks/tweak_group_top_bar.py
a233c0
+++ b/gtweak/tweaks/tweak_group_top_bar.py
a233c0
@@ -1,3 +1,4 @@
a233c0
+# -*- coding: utf-8 -*-
a233c0
 # Copyright (c) 2011 John Stowers
a233c0
 # SPDX-License-Identifier: GPL-3.0+
a233c0
 # License-Filename: LICENSES/GPL-3.0
a233c0
@@ -10,7 +11,7 @@ from gtweak.utils import XSettingsOverrides
a233c0
 _shell = GnomeShellFactory().get_shell()
a233c0
 _shell_loaded = _shell is not None
a233c0
 
a233c0
-class ApplicationMenuTweak(GetterSetterSwitchTweak):
a233c0
+class ApplicationMenuTweak(GetterSetterSwitchTweak,  _GSettingsTweak):
a233c0
     def __init__(self, **options):
a233c0
         self._xsettings = XSettingsOverrides()
a233c0
         name = _("Application Menu")
a233c0
diff --git a/gtweak/tweaks/tweak_group_windows.py b/gtweak/tweaks/tweak_group_windows.py
a233c0
index 3ac8964..0743689 100644
a233c0
--- a/gtweak/tweaks/tweak_group_windows.py
a233c0
+++ b/gtweak/tweaks/tweak_group_windows.py
a233c0
@@ -1,3 +1,4 @@
a233c0
+# -*- coding: utf-8 -*-
a233c0
 # Copyright (c) 2011 John Stowers
a233c0
 # SPDX-License-Identifier: GPL-3.0+
a233c0
 # License-Filename: LICENSES/GPL-3.0
a233c0
diff --git a/gtweak/tweaks/tweak_group_workspaces.py b/gtweak/tweaks/tweak_group_workspaces.py
a233c0
index 1805861..dd28b4c 100644
a233c0
--- a/gtweak/tweaks/tweak_group_workspaces.py
a233c0
+++ b/gtweak/tweaks/tweak_group_workspaces.py
a233c0
@@ -1,3 +1,4 @@
a233c0
+# -*- coding: utf-8 -*-
a233c0
 # Copyright (c) 2011 John Stowers
a233c0
 # SPDX-License-Identifier: GPL-3.0+
a233c0
 # License-Filename: LICENSES/GPL-3.0
a233c0
@@ -89,7 +90,7 @@ class StaticWorkspaceTweak(Gtk.ListBox, _GSettingsTweak):
a233c0
             self.check1.hide()
a233c0
             self.check2.show()
a233c0
 
a233c0
-class PrimaryWorkspaceTweak(Gtk.ListBox, Tweak):
a233c0
+class PrimaryWorkspaceTweak(Gtk.ListBox,  _GSettingsTweak):
a233c0
 
a233c0
     def __init__(self, **options):
a233c0
         name = _("Workspaces")
a233c0
diff --git a/gtweak/tweaks/tweak_group_xkb.py b/gtweak/tweaks/tweak_group_xkb.py
a233c0
index 9cb3670..659b08a 100644
a233c0
--- a/gtweak/tweaks/tweak_group_xkb.py
a233c0
+++ b/gtweak/tweaks/tweak_group_xkb.py
a233c0
@@ -1,3 +1,4 @@
a233c0
+# -*- coding: utf-8 -*-
a233c0
 # Copyright (c) 2012 Red Hat, Inc.
a233c0
 # Authors:
a233c0
 #       Rui Matos
a233c0
@@ -117,7 +118,7 @@ class _XkbOption(Gtk.Expander, Tweak):
a233c0
                 if w:
a233c0
                     _set_active(w, True)
a233c0
         else:
a233c0
-            for w in list(self._widgets.values()):
a233c0
+            for w in self._widgets.values():
a233c0
                 if w._val in self._values:
a233c0
                     _set_active(w, True)
a233c0
                 else:
a233c0
@@ -134,7 +135,7 @@ class _XkbOption(Gtk.Expander, Tweak):
a233c0
         elif active and not w._val in self._values and w._val:
a233c0
             self._parent_settings.setting_add_to_list(TypingTweakGroup.XKB_GSETTINGS_NAME, w._val)
a233c0
 
a233c0
-class TypingTweakGroup(Gtk.Box):
a233c0
+class TypingTweakGroup(Gtk.Box, TweakGroup):
a233c0
 
a233c0
     XKB_GSETTINGS_SCHEMA = "org.gnome.desktop.input-sources"
a233c0
     XKB_GSETTINGS_NAME = "xkb-options"
a233c0
diff --git a/gtweak/tweaks/tweak_wacom.py b/gtweak/tweaks/tweak_wacom.py
a233c0
index ed227ca..2e89246 100644
a233c0
--- a/gtweak/tweaks/tweak_wacom.py
a233c0
+++ b/gtweak/tweaks/tweak_wacom.py
a233c0
@@ -1,3 +1,4 @@
a233c0
+# -*- coding: utf-8 -*-
a233c0
 # Copyright (c) 2013 Red Hat, Inc.
a233c0
 # Author: Joaquim Rocha <jrocha@redhat.com>
a233c0
 # SPDX-License-Identifier: GPL-3.0+
a233c0
@@ -6,7 +7,7 @@
a233c0
 from gtweak.tweakmodel import TweakGroup
a233c0
 from gtweak.widgets import GSettingsSwitchTweak
a233c0
 import subprocess
a233c0
-import configparser
a233c0
+import ConfigParser
a233c0
 import io
a233c0
 
a233c0
 def N_(x): return x
a233c0
@@ -88,10 +89,10 @@ class WacomConfigs(object):
a233c0
                 match_id = config.get(DEVICE_SECTION, DEVICE_MATCH_LINE)
a233c0
                 # Use a dict to discard possible repeated devices
a233c0
                 configs_dict[match_id] = config
a233c0
-        return list(configs_dict.values())
a233c0
+        return configs_dict.values()
a233c0
 
a233c0
     def _text_to_config(self, text):
a233c0
-        config = configparser.RawConfigParser(allow_no_value=True)
a233c0
+        config = ConfigParser.RawConfigParser(allow_no_value=True)
a233c0
         config.readfp(io.BytesIO(text))
a233c0
         return config
a233c0
 
a233c0
@@ -108,4 +109,4 @@ class WacomSwitchTweak(GSettingsSwitchTweak):
a233c0
                                       **options)
a233c0
 wg = WacomGroup()
a233c0
 if wg.tweaks:
a233c0
-    TWEAK_GROUPS = (wg,)
a233c0
+    TWEAK_GROUPS = (wg,)
a233c0
\ No newline at end of file
a233c0
diff --git a/gtweak/tweakview.py b/gtweak/tweakview.py
a233c0
index a130fea..6c640ba 100644
a233c0
--- a/gtweak/tweakview.py
a233c0
+++ b/gtweak/tweakview.py
a233c0
@@ -1,3 +1,4 @@
a233c0
+# -*- coding: utf-8 -*-
a233c0
 # Copyright (c) 2011 John Stowers
a233c0
 # SPDX-License-Identifier: GPL-3.0+
a233c0
 # License-Filename: LICENSES/GPL-3.0
a233c0
@@ -157,7 +158,7 @@ class Window(Gtk.ApplicationWindow):
a233c0
             row.add(lbl)
a233c0
             return row
a233c0
 
a233c0
-        groups = list(self._model._tweak_group_names.keys())
a233c0
+        groups = self._model._tweak_group_names.keys()
a233c0
         groups = sorted(groups)
a233c0
 
a233c0
         for g in groups:
a233c0
@@ -263,4 +264,4 @@ class Window(Gtk.ApplicationWindow):
a233c0
             if t in tweaks:
a233c0
                 t.show_all()
a233c0
             else:
a233c0
-                t.hide()
a233c0
+                t.hide()
a233c0
\ No newline at end of file
a233c0
diff --git a/gtweak/utils.py b/gtweak/utils.py
a233c0
index 6f0c25c..258acf4 100644
a233c0
--- a/gtweak/utils.py
a233c0
+++ b/gtweak/utils.py
a233c0
@@ -1,3 +1,4 @@
a233c0
+# -*- coding: utf-8 -*-
a233c0
 # Copyright (c) 2011 John Stowers
a233c0
 # SPDX-License-Identifier: GPL-3.0+
a233c0
 # License-Filename: LICENSES/GPL-3.0
a233c0
@@ -161,7 +162,11 @@ class AutostartFile:
a233c0
             self._extra_exec_args = "\n"
a233c0
 
a233c0
         user_autostart_dir = os.path.join(GLib.get_user_config_dir(), "autostart")
a233c0
-        os.makedirs(user_autostart_dir, exist_ok=True)
a233c0
+        if not os.path.isdir(user_autostart_dir):
a233c0
+            try:
a233c0
+                os.makedirs(user_autostart_dir)
a233c0
+            except:
a233c0
+                logging.critical("Could not create autostart dir: %s" % user_autostart_dir)
a233c0
 
a233c0
         self._user_autostart_file = os.path.join(user_autostart_dir, self._autostart_desktop_filename)
a233c0
 
a233c0
@@ -269,7 +274,7 @@ class XSettingsOverrides:
a233c0
 
a233c0
     def _dup_variant_as_dict(self):
a233c0
         items = {}
a233c0
-        for k in list(self._variant.keys()):
a233c0
+        for k in self._variant.keys():
a233c0
             try:
a233c0
                 #variant override doesnt support .items()
a233c0
                 v = self._variant[k]
a233c0
@@ -352,4 +357,4 @@ class LogoutNotification:
a233c0
                        '/org/gnome/SessionManager',
a233c0
                        'org.gnome.SessionManager',
a233c0
                        None)
a233c0
-        proxy.Logout('(u)', 0)
a233c0
+        proxy.Logout('(u)', 0)
a233c0
\ No newline at end of file
a233c0
diff --git a/gtweak/widgets.py b/gtweak/widgets.py
a233c0
index 3d48a51..11cd557 100644
a233c0
--- a/gtweak/widgets.py
a233c0
+++ b/gtweak/widgets.py
a233c0
@@ -1,3 +1,4 @@
a233c0
+# -*- coding: utf-8 -*-
a233c0
 # Copyright (c) 2011 John Stowers
a233c0
 # SPDX-License-Identifier: GPL-3.0+
a233c0
 # License-Filename: LICENSES/GPL-3.0
a233c0
diff --git a/meson-postinstall.py b/meson-postinstall.py
a233c0
index 115d8e0..3b41cc4 100755
a233c0
--- a/meson-postinstall.py
a233c0
+++ b/meson-postinstall.py
a233c0
@@ -1,4 +1,4 @@
a233c0
-#!/usr/bin/env python3
a233c0
+#!/usr/bin/env python
a233c0
 
a233c0
 import sysconfig
a233c0
 from compileall import compile_dir
a233c0
@@ -16,4 +16,4 @@ if not destdir:
a233c0
 
a233c0
 print('Compiling python bytecode...')
a233c0
 moduledir = sysconfig.get_path('purelib', vars={'base': str(prefix)})
a233c0
-compile_dir(destdir + path.join(moduledir, 'gtweak'), optimize=2)
a233c0
+compile_dir(destdir + path.join(moduledir, 'gtweak'))
a233c0
diff --git a/meson.build b/meson.build
a233c0
index 4d24fa5..f5ea92d 100644
a233c0
--- a/meson.build
a233c0
+++ b/meson.build
a233c0
@@ -5,7 +5,6 @@ project('gnome-tweaks',
a233c0
 
a233c0
 gnome = import('gnome')
a233c0
 i18n = import('i18n')
a233c0
-python3 = import('python3')
a233c0
 
a233c0
 prefix = get_option('prefix')
a233c0
 
a233c0
@@ -13,7 +12,7 @@ bindir = join_paths(prefix, get_option('bindir'))
a233c0
 datadir = join_paths(prefix, get_option('datadir'))
a233c0
 libexecdir = join_paths(prefix, get_option('libexecdir'))
a233c0
 localedir = join_paths(prefix, get_option('localedir'))
a233c0
-pythondir = join_paths(prefix, python3.sysconfig_path('purelib'))
a233c0
+pythondir = join_paths(prefix, '/usr/lib/python2.7/site-packages')
a233c0
 
a233c0
 pkgdatadir = join_paths(datadir, meson.project_name())
a233c0
 
a233c0
-- 
a233c0
2.17.0
a233c0