1 From acfbbc4ea40932f183617bb7006700140fe5f61e Mon Sep 17 00:00:00 2001
2 From: Troy Curtis Jr <troycurtisjr@gmail.com>
3 Date: Wed, 13 Sep 2017 21:59:48 -0500
4 Subject: [PATCH] Add python3 support to openbox-xdg-autostart.
6 Updated syntax in openbox-xdg-autostart to support both python2 and
9 Added a configure substitution to set the choosen python at build time.
11 https://bugzilla.icculus.org/show_bug.cgi?id=6444
15 ...xdg-autostart => openbox-xdg-autostart.in} | 70 +++++++++----------
16 3 files changed, 38 insertions(+), 36 deletions(-)
17 rename data/autostart/{openbox-xdg-autostart => openbox-xdg-autostart.in} (77%)
19 diff --git a/configure.ac b/configure.ac
20 index ca1602670..9a31e9845 100644
23 @@ -103,6 +103,8 @@ AC_CHECK_HEADERS(ctype.h dirent.h errno.h fcntl.h grp.h locale.h pwd.h)
24 AC_CHECK_HEADERS(signal.h string.h stdio.h stdlib.h unistd.h sys/stat.h)
25 AC_CHECK_HEADERS(sys/select.h sys/socket.h sys/time.h sys/types.h sys/wait.h)
27 +AM_PATH_PYTHON([2],,)
29 AC_PATH_PROG([SED], [sed], [no])
30 if test "$SED" = "no"; then
31 AC_MSG_ERROR([The program "sed" is not available. This program is required to build Openbox.])
32 @@ -259,6 +261,7 @@ AC_CONFIG_FILES([
36 + data/autostart/openbox-xdg-autostart
38 AC_CONFIG_COMMANDS([doc],
39 [test -d doc || mkdir doc])
40 diff --git a/data/autostart/openbox-xdg-autostart b/data/autostart/openbox-xdg-autostart.in
42 rename from data/autostart/openbox-xdg-autostart
43 rename to data/autostart/openbox-xdg-autostart.in
44 index 04a17a199..3c365b112 100755
45 --- a/data/autostart/openbox-xdg-autostart
46 +++ b/data/autostart/openbox-xdg-autostart.in
48 -#!/usr/bin/env python
51 # openbox-xdg-autostart runs things based on the XDG autostart specification
52 # Copyright (C) 2008 Dana Jansens
53 @@ -28,9 +28,7 @@ try:
54 from xdg.DesktopEntry import DesktopEntry
55 from xdg.Exceptions import ParsingError
58 - print >>sys.stderr, "ERROR:", ME, "requires PyXDG to be installed"
60 + sys.stderr.write("\nERROR: %s requires PyXDG to be installed\n" % ME)
63 def main(argv=sys.argv):
64 @@ -51,7 +49,7 @@ def main(argv=sys.argv):
66 autofile = AutostartFile(path)
68 - print "Invalid .desktop file: " + path
69 + print("Invalid .desktop file: " + path)
71 if not autofile in files:
72 files.append(autofile)
73 @@ -99,9 +97,9 @@ class AutostartFile:
75 def _alert(self, str, info=False):
83 def _showInEnvironment(self, envs, verbose=False):
84 default = not self.de.getOnlyShowIn()
85 @@ -146,14 +144,14 @@ class AutostartFile:
87 def display(self, envs):
88 if self._shouldRun(envs):
89 - print "[*] " + self.de.getName()
90 + print("[*] " + self.de.getName())
92 - print "[ ] " + self.de.getName()
93 + print("[ ] " + self.de.getName())
94 self._alert("File: " + self.path, info=True)
96 self._alert("Executes: " + self.de.getExec(), info=True)
97 self._shouldRun(envs, True)
103 @@ -165,34 +163,34 @@ class AutostartFile:
107 - print "Usage:", ME, "[OPTION]... [ENVIRONMENT]..."
109 - print "This tool will run xdg autostart .desktop files"
112 - print " --list Show a list of the files which would be run"
113 - print " Files which would be run are marked with an asterix"
114 - print " symbol [*]. For files which would not be run,"
115 - print " information is given for why they are excluded"
116 - print " --help Show this help and exit"
117 - print " --version Show version and copyright information"
119 - print "ENVIRONMENT specifies a list of environments for which to run autostart"
120 - print "applications. If none are specified, only applications which do not "
121 - print "limit themselves to certain environments will be run."
123 - print "ENVIRONMENT can be one or more of:"
124 - print " GNOME Gnome Desktop"
125 - print " KDE KDE Desktop"
126 - print " ROX ROX Desktop"
127 - print " XFCE XFCE Desktop"
128 - print " Old Legacy systems"
130 + print("Usage:", ME, "[OPTION]... [ENVIRONMENT]...")
132 + print("This tool will run xdg autostart .desktop files")
135 + print(" --list Show a list of the files which would be run")
136 + print(" Files which would be run are marked with an asterix")
137 + print(" symbol [*]. For files which would not be run,")
138 + print(" information is given for why they are excluded")
139 + print(" --help Show this help and exit")
140 + print(" --version Show version and copyright information")
142 + print("ENVIRONMENT specifies a list of environments for which to run autostart")
143 + print("applications. If none are specified, only applications which do not ")
144 + print("limit themselves to certain environments will be run.")
146 + print("ENVIRONMENT can be one or more of:")
147 + print(" GNOME Gnome Desktop")
148 + print(" KDE KDE Desktop")
149 + print(" ROX ROX Desktop")
150 + print(" XFCE XFCE Desktop")
151 + print(" Old Legacy systems")
156 - print "Copyright (c) 2008 Dana Jansens"
159 + print("Copyright (c) 2008 Dana Jansens")
162 if __name__ == "__main__":