Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 1 | From b7de9cff2a9578dd92d191241c28437cd6bbb595 Mon Sep 17 00:00:00 2001 |
| 2 | From: Max Krummenacher <max.krummenacher@toradex.com> |
| 3 | Date: Sun, 2 Feb 2020 14:39:21 +0000 |
| 4 | Subject: [PATCH] openbox-xdg-autostart: convert to python3 |
| 5 | |
| 6 | Upstream-Status: Pending |
| 7 | |
| 8 | Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com> |
| 9 | --- |
| 10 | data/autostart/openbox-xdg-autostart | 72 ++++++++++++++-------------- |
| 11 | 1 file changed, 36 insertions(+), 36 deletions(-) |
| 12 | |
| 13 | diff --git a/data/autostart/openbox-xdg-autostart b/data/autostart/openbox-xdg-autostart |
| 14 | index 04a17a1..52d763f 100755 |
| 15 | --- a/data/autostart/openbox-xdg-autostart |
| 16 | +++ b/data/autostart/openbox-xdg-autostart |
| 17 | @@ -1,4 +1,4 @@ |
| 18 | -#!/usr/bin/env python |
| 19 | +#!/usr/bin/env python3 |
| 20 | |
| 21 | # openbox-xdg-autostart runs things based on the XDG autostart specification |
| 22 | # Copyright (C) 2008 Dana Jansens |
| 23 | @@ -28,9 +28,9 @@ try: |
| 24 | from xdg.DesktopEntry import DesktopEntry |
| 25 | from xdg.Exceptions import ParsingError |
| 26 | except ImportError: |
| 27 | - print |
| 28 | - print >>sys.stderr, "ERROR:", ME, "requires PyXDG to be installed" |
| 29 | - print |
| 30 | + print() |
| 31 | + print("ERROR:", ME, "requires PyXDG to be installed", file=sys.stderr) |
| 32 | + print() |
| 33 | sys.exit(1) |
| 34 | |
| 35 | def main(argv=sys.argv): |
| 36 | @@ -51,7 +51,7 @@ def main(argv=sys.argv): |
| 37 | try: |
| 38 | autofile = AutostartFile(path) |
| 39 | except ParsingError: |
| 40 | - print "Invalid .desktop file: " + path |
| 41 | + print("Invalid .desktop file: " + path) |
| 42 | else: |
| 43 | if not autofile in files: |
| 44 | files.append(autofile) |
| 45 | @@ -99,9 +99,9 @@ class AutostartFile: |
| 46 | |
| 47 | def _alert(self, str, info=False): |
| 48 | if info: |
| 49 | - print "\t ", str |
| 50 | + print("\t ", str) |
| 51 | else: |
| 52 | - print "\t*", str |
| 53 | + print("\t*", str) |
| 54 | |
| 55 | def _showInEnvironment(self, envs, verbose=False): |
| 56 | default = not self.de.getOnlyShowIn() |
| 57 | @@ -146,14 +146,14 @@ class AutostartFile: |
| 58 | |
| 59 | def display(self, envs): |
| 60 | if self._shouldRun(envs): |
| 61 | - print "[*] " + self.de.getName() |
| 62 | + print("[*] " + self.de.getName()) |
| 63 | else: |
| 64 | - print "[ ] " + self.de.getName() |
| 65 | + print("[ ] " + self.de.getName()) |
| 66 | self._alert("File: " + self.path, info=True) |
| 67 | if self.de.getExec(): |
| 68 | self._alert("Executes: " + self.de.getExec(), info=True) |
| 69 | self._shouldRun(envs, True) |
| 70 | - print |
| 71 | + print() |
| 72 | |
| 73 | def run(self, envs): |
| 74 | here = os.getcwd() |
| 75 | @@ -165,34 +165,34 @@ class AutostartFile: |
| 76 | os.chdir(here) |
| 77 | |
| 78 | def show_help(): |
| 79 | - print "Usage:", ME, "[OPTION]... [ENVIRONMENT]..." |
| 80 | - print |
| 81 | - print "This tool will run xdg autostart .desktop files" |
| 82 | - print |
| 83 | - print "OPTIONS" |
| 84 | - print " --list Show a list of the files which would be run" |
| 85 | - print " Files which would be run are marked with an asterix" |
| 86 | - print " symbol [*]. For files which would not be run," |
| 87 | - print " information is given for why they are excluded" |
| 88 | - print " --help Show this help and exit" |
| 89 | - print " --version Show version and copyright information" |
| 90 | - print |
| 91 | - print "ENVIRONMENT specifies a list of environments for which to run autostart" |
| 92 | - print "applications. If none are specified, only applications which do not " |
| 93 | - print "limit themselves to certain environments will be run." |
| 94 | - print |
| 95 | - print "ENVIRONMENT can be one or more of:" |
| 96 | - print " GNOME Gnome Desktop" |
| 97 | - print " KDE KDE Desktop" |
| 98 | - print " ROX ROX Desktop" |
| 99 | - print " XFCE XFCE Desktop" |
| 100 | - print " Old Legacy systems" |
| 101 | - print |
| 102 | + print("Usage:", ME, "[OPTION]... [ENVIRONMENT]...") |
| 103 | + print() |
| 104 | + print("This tool will run xdg autostart .desktop files") |
| 105 | + print() |
| 106 | + print("OPTIONS") |
| 107 | + print(" --list Show a list of the files which would be run") |
| 108 | + print(" Files which would be run are marked with an asterix") |
| 109 | + print(" symbol [*]. For files which would not be run,") |
| 110 | + print(" information is given for why they are excluded") |
| 111 | + print(" --help Show this help and exit") |
| 112 | + print(" --version Show version and copyright information") |
| 113 | + print() |
| 114 | + print("ENVIRONMENT specifies a list of environments for which to run autostart") |
| 115 | + print("applications. If none are specified, only applications which do not ") |
| 116 | + print("limit themselves to certain environments will be run.") |
| 117 | + print() |
| 118 | + print("ENVIRONMENT can be one or more of:") |
| 119 | + print(" GNOME Gnome Desktop") |
| 120 | + print(" KDE KDE Desktop") |
| 121 | + print(" ROX ROX Desktop") |
| 122 | + print(" XFCE XFCE Desktop") |
| 123 | + print(" Old Legacy systems") |
| 124 | + print() |
| 125 | |
| 126 | def show_version(): |
| 127 | - print ME, VERSION |
| 128 | - print "Copyright (c) 2008 Dana Jansens" |
| 129 | - print |
| 130 | + print(ME, VERSION) |
| 131 | + print("Copyright (c) 2008 Dana Jansens") |
| 132 | + print() |
| 133 | |
| 134 | if __name__ == "__main__": |
| 135 | sys.exit(main()) |
| 136 | -- |
| 137 | 2.20.1 |
| 138 | |