py2-to-py3.patch 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. --- a/data/autostart/openbox-xdg-autostart
  2. +++ b/data/autostart/openbox-xdg-autostart
  3. @@ -1,4 +1,4 @@
  4. -#!/usr/bin/env python
  5. +#!/usr/bin/env python3
  6. # openbox-xdg-autostart runs things based on the XDG autostart specification
  7. # Copyright (C) 2008 Dana Jansens
  8. @@ -28,9 +28,9 @@
  9. from xdg.DesktopEntry import DesktopEntry
  10. from xdg.Exceptions import ParsingError
  11. except ImportError:
  12. - print
  13. - print >>sys.stderr, "ERROR:", ME, "requires PyXDG to be installed"
  14. - print
  15. + print()
  16. + print("ERROR:", ME, "requires PyXDG to be installed", file=sys.stderr)
  17. + print()
  18. sys.exit(1)
  19. def main(argv=sys.argv):
  20. @@ -51,7 +51,7 @@
  21. try:
  22. autofile = AutostartFile(path)
  23. except ParsingError:
  24. - print "Invalid .desktop file: " + path
  25. + print("Invalid .desktop file: " + path)
  26. else:
  27. if not autofile in files:
  28. files.append(autofile)
  29. @@ -99,9 +99,9 @@
  30. def _alert(self, str, info=False):
  31. if info:
  32. - print "\t ", str
  33. + print("\t ", str)
  34. else:
  35. - print "\t*", str
  36. + print("\t*", str)
  37. def _showInEnvironment(self, envs, verbose=False):
  38. default = not self.de.getOnlyShowIn()
  39. @@ -146,14 +146,14 @@
  40. def display(self, envs):
  41. if self._shouldRun(envs):
  42. - print "[*] " + self.de.getName()
  43. + print("[*] " + self.de.getName())
  44. else:
  45. - print "[ ] " + self.de.getName()
  46. + print("[ ] " + self.de.getName())
  47. self._alert("File: " + self.path, info=True)
  48. if self.de.getExec():
  49. self._alert("Executes: " + self.de.getExec(), info=True)
  50. self._shouldRun(envs, True)
  51. - print
  52. + print()
  53. def run(self, envs):
  54. here = os.getcwd()
  55. @@ -165,34 +165,34 @@
  56. os.chdir(here)
  57. def show_help():
  58. - print "Usage:", ME, "[OPTION]... [ENVIRONMENT]..."
  59. - print
  60. - print "This tool will run xdg autostart .desktop files"
  61. - print
  62. - print "OPTIONS"
  63. - print " --list Show a list of the files which would be run"
  64. - print " Files which would be run are marked with an asterix"
  65. - print " symbol [*]. For files which would not be run,"
  66. - print " information is given for why they are excluded"
  67. - print " --help Show this help and exit"
  68. - print " --version Show version and copyright information"
  69. - print
  70. - print "ENVIRONMENT specifies a list of environments for which to run autostart"
  71. - print "applications. If none are specified, only applications which do not "
  72. - print "limit themselves to certain environments will be run."
  73. - print
  74. - print "ENVIRONMENT can be one or more of:"
  75. - print " GNOME Gnome Desktop"
  76. - print " KDE KDE Desktop"
  77. - print " ROX ROX Desktop"
  78. - print " XFCE XFCE Desktop"
  79. - print " Old Legacy systems"
  80. - print
  81. + print("Usage:", ME, "[OPTION]... [ENVIRONMENT]...")
  82. + print()
  83. + print("This tool will run xdg autostart .desktop files")
  84. + print()
  85. + print("OPTIONS")
  86. + print(" --list Show a list of the files which would be run")
  87. + print(" Files which would be run are marked with an asterix")
  88. + print(" symbol [*]. For files which would not be run,")
  89. + print(" information is given for why they are excluded")
  90. + print(" --help Show this help and exit")
  91. + print(" --version Show version and copyright information")
  92. + print()
  93. + print("ENVIRONMENT specifies a list of environments for which to run autostart")
  94. + print("applications. If none are specified, only applications which do not ")
  95. + print("limit themselves to certain environments will be run.")
  96. + print()
  97. + print("ENVIRONMENT can be one or more of:")
  98. + print(" GNOME Gnome Desktop")
  99. + print(" KDE KDE Desktop")
  100. + print(" ROX ROX Desktop")
  101. + print(" XFCE XFCE Desktop")
  102. + print(" Old Legacy systems")
  103. + print()
  104. def show_version():
  105. - print ME, VERSION
  106. - print "Copyright (c) 2008 Dana Jansens"
  107. - print
  108. + print(ME, VERSION)
  109. + print("Copyright (c) 2008 Dana Jansens")
  110. + print()
  111. if __name__ == "__main__":
  112. sys.exit(main())