1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-26 05:02:18 +00:00

x11-wm/openbox: fix openbox-xdg-autostart for Python 3

Openbox includes a Python script (openbox-xdg-autostart)
which implements the XDG autostart spec
(https://www.freedesktop.org/wiki/Specifications/autostart-spec/).
The switch of the default Python to 3.6 in ports r498529 broke the script.
The added patch makes the script work again with both Python 2 and 3.
Luckily the only problem was "print" being changed from a keyword
to a regular function.

PR:		237319
Submitted by:	Sebastian Schwarz
This commit is contained in:
Roman Bogorodskiy 2019-04-18 14:13:35 +00:00
parent ed41ef978a
commit b7e771196d
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=499266
2 changed files with 125 additions and 1 deletions

View File

@ -3,7 +3,7 @@
PORTNAME= openbox
PORTVERSION= 3.6
PORTREVISION= 4
PORTREVISION= 5
CATEGORIES= x11-wm
MASTER_SITES= http://openbox.org/dist/openbox/

View File

@ -0,0 +1,124 @@
--- data/autostart/openbox-xdg-autostart.orig 2019-04-15 20:40:28 UTC
+++ data/autostart/openbox-xdg-autostart
@@ -19,6 +19,8 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
+from __future__ import print_function
+
ME="openbox-xdg-autostart"
VERSION="1.1"
@@ -28,9 +30,9 @@ try:
from xdg.DesktopEntry import DesktopEntry
from xdg.Exceptions import ParsingError
except ImportError:
- print
- print >>sys.stderr, "ERROR:", ME, "requires PyXDG to be installed"
- print
+ print()
+ print("ERROR:", ME, "requires PyXDG to be installed", file=sys.stderr)
+ print()
sys.exit(1)
def main(argv=sys.argv):
@@ -51,7 +53,7 @@ def main(argv=sys.argv):
try:
autofile = AutostartFile(path)
except ParsingError:
- print "Invalid .desktop file: " + path
+ print("Invalid .desktop file: " + path)
else:
if not autofile in files:
files.append(autofile)
@@ -99,9 +101,9 @@ class AutostartFile:
def _alert(self, str, info=False):
if info:
- print "\t ", str
+ print("\t ", str)
else:
- print "\t*", str
+ print("\t*", str)
def _showInEnvironment(self, envs, verbose=False):
default = not self.de.getOnlyShowIn()
@@ -146,14 +148,14 @@ class AutostartFile:
def display(self, envs):
if self._shouldRun(envs):
- print "[*] " + self.de.getName()
+ print("[*] " + self.de.getName())
else:
- print "[ ] " + self.de.getName()
+ print("[ ] " + self.de.getName())
self._alert("File: " + self.path, info=True)
if self.de.getExec():
self._alert("Executes: " + self.de.getExec(), info=True)
self._shouldRun(envs, True)
- print
+ print()
def run(self, envs):
here = os.getcwd()
@@ -165,34 +167,34 @@ class AutostartFile:
os.chdir(here)
def show_help():
- print "Usage:", ME, "[OPTION]... [ENVIRONMENT]..."
- print
- print "This tool will run xdg autostart .desktop files"
- print
- print "OPTIONS"
- print " --list Show a list of the files which would be run"
- print " Files which would be run are marked with an asterix"
- print " symbol [*]. For files which would not be run,"
- print " information is given for why they are excluded"
- print " --help Show this help and exit"
- print " --version Show version and copyright information"
- print
- print "ENVIRONMENT specifies a list of environments for which to run autostart"
- print "applications. If none are specified, only applications which do not "
- print "limit themselves to certain environments will be run."
- print
- print "ENVIRONMENT can be one or more of:"
- print " GNOME Gnome Desktop"
- print " KDE KDE Desktop"
- print " ROX ROX Desktop"
- print " XFCE XFCE Desktop"
- print " Old Legacy systems"
- print
+ print("Usage:", ME, "[OPTION]... [ENVIRONMENT]...")
+ print()
+ print("This tool will run xdg autostart .desktop files")
+ print()
+ print("OPTIONS")
+ print(" --list Show a list of the files which would be run")
+ print(" Files which would be run are marked with an asterix")
+ print(" symbol [*]. For files which would not be run,")
+ print(" information is given for why they are excluded")
+ print(" --help Show this help and exit")
+ print(" --version Show version and copyright information")
+ print()
+ print("ENVIRONMENT specifies a list of environments for which to run autostart")
+ print("applications. If none are specified, only applications which do not ")
+ print("limit themselves to certain environments will be run.")
+ print()
+ print("ENVIRONMENT can be one or more of:")
+ print(" GNOME Gnome Desktop")
+ print(" KDE KDE Desktop")
+ print(" ROX ROX Desktop")
+ print(" XFCE XFCE Desktop")
+ print(" Old Legacy systems")
+ print()
def show_version():
- print ME, VERSION
- print "Copyright (c) 2008 Dana Jansens"
- print
+ print(ME, VERSION)
+ print("Copyright (c) 2008 Dana Jansens")
+ print()
if __name__ == "__main__":
sys.exit(main())