summarylogtreecommitdiffstats
path: root/0001-Python-3-port.patch
blob: 14a92f62a11f4f1bae8566ddff190804d6c12021 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
From 2bbb41c38f81f53e5c8d0be7a1847bc0674fd424 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ball=C3=B3=20Gy=C3=B6rgy?= <ballogyor@gmail.com>
Date: Mon, 9 Mar 2020 20:06:25 +0100
Subject: [PATCH] Python 3 port

---
 scripts/sugar-runner.in | 6 +++---
 scripts/tweak-xwrapper  | 2 +-
 scripts/xephyr-window   | 4 ++--
 scripts/xinitrc         | 8 ++++----
 4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/scripts/sugar-runner.in b/scripts/sugar-runner.in
index f39bdfb..9aa83ff 100644
--- a/scripts/sugar-runner.in
+++ b/scripts/sugar-runner.in
@@ -1,4 +1,4 @@
-#!/usr/bin/python2 -u
+#!/usr/bin/python -u
 
 # Copyright (C) 2013, Daniel Narvaez
 #
@@ -66,7 +66,7 @@ def _allow_to_run_x():
     except IOError:
         return
 
-    print "We need to allow everybody to run the X server"
+    print("We need to allow everybody to run the X server")
     tweak_wrapper = os.path.join(helpers_dir, "tweak-xwrapper")
     subprocess.check_call(["sudo", "-k", tweak_wrapper])
 
@@ -83,7 +83,7 @@ def _run_xephyr_window(resolution):
 
 def _get_tty_number():
     tty = subprocess.check_output(["tty"])
-    head, tail = os.path.split(tty)
+    head, tail = os.path.split(tty.decode('ascii'))
     return tail.strip().replace("tty", "")
 
 
diff --git a/scripts/tweak-xwrapper b/scripts/tweak-xwrapper
index 05f9c6e..87ceec1 100644
--- a/scripts/tweak-xwrapper
+++ b/scripts/tweak-xwrapper
@@ -1,4 +1,4 @@
-#!/usr/bin/python2 -u
+#!/usr/bin/python -u
 
 # Copyright (C) 2013, Daniel Narvaez
 #
diff --git a/scripts/xephyr-window b/scripts/xephyr-window
index 0c5e98b..c43434a 100644
--- a/scripts/xephyr-window
+++ b/scripts/xephyr-window
@@ -1,4 +1,4 @@
-#!/usr/bin/python2 -u
+#!/usr/bin/python -u
 
 # Copyright (C) 2013, Daniel Narvaez
 #
@@ -40,5 +40,5 @@ SugarRunner.window_create(int(width), int(height), fullscreen)
 while SugarRunner.window_wait():
     if not fullscreen or SugarRunner.window_is_fullscreen():
         if not xid_printed:
-            print SugarRunner.window_get_xid()
+            print(SugarRunner.window_get_xid())
             xid_printed = True
diff --git a/scripts/xinitrc b/scripts/xinitrc
index 904822e..de75d8f 100644
--- a/scripts/xinitrc
+++ b/scripts/xinitrc
@@ -1,4 +1,4 @@
-#!/usr/bin/python2
+#!/usr/bin/python
 
 # Copyright (C) 2013, Daniel Narvaez
 #
@@ -48,7 +48,7 @@ def _load_xkb_config():
     if "SUGAR_RUNNER_XKBCONFIG" not in os.environ:
         return
 
-    with open(os.environ["SUGAR_RUNNER_XKBCONFIG"]) as f:
+    with open(os.environ["SUGAR_RUNNER_XKBCONFIG"], 'rb') as f:
         config = f.read()
 
     process = subprocess.Popen(["xkbcomp", "-", os.environ["DISPLAY"]],
@@ -65,14 +65,14 @@ def _add_output_to_environ(output):
 
 def _start_dbus():
     output = subprocess.check_output(["dbus-launch", "--exit-with-session"])
-    _add_output_to_environ(output)
+    _add_output_to_environ(output.decode('ascii'))
 
 
 def _start_keyring():
     output = subprocess.check_output(["gnome-keyring-daemon",
                                       "--start", "-d",
                                       "--components=secrets,pkcs11,ssh,gpg"])
-    _add_output_to_environ(output)
+    _add_output_to_environ(output.decode('ascii'))
 
 
 def _setup_xdg_user_dirs():
-- 
2.25.1