Skip to content
Snippets Groups Projects
Commit 23893ec5 authored by Chih-Hsuan Yen's avatar Chih-Hsuan Yen
Browse files

use Python 3 for openbox-xdg-autostart

parent 4dcaf90d
No related branches found
No related tags found
No related merge requests found
......@@ -7,7 +7,7 @@
pkgname=openbox
pkgver=3.6.1
pkgrel=5
pkgrel=6
pkgdesc='Highly configurable and lightweight X11 window manager'
arch=('x86_64')
url='http://openbox.org'
......@@ -15,20 +15,23 @@ license=('GPL')
provides=(libobrender.so)
depends=('startup-notification' 'libxml2' 'libxinerama' 'libxrandr'
'libxcursor' 'pango' 'imlib2' 'librsvg' 'libsm')
makedepends=('python')
optdepends=('plasma-workspace: for the KDE/Openbox xsession'
'python2-xdg: for the openbox-xdg-autostart script')
'python-xdg: for the openbox-xdg-autostart script')
groups=('lxde' 'lxde-gtk3' 'lxqt')
backup=('etc/xdg/openbox/menu.xml' 'etc/xdg/openbox/rc.xml'
'etc/xdg/openbox/autostart' 'etc/xdg/openbox/environment')
source=(http://openbox.org/dist/openbox/$pkgname-$pkgver.tar.gz{,.asc}
openbox-3.5.0-title-matching.patch
openbox-3.5.0-which-2.20.patch
$pkgname-kde-paths.patch)
$pkgname-kde-paths.patch
py3.patch)
md5sums=('b72794996c6a3ad94634727b95f9d204'
'SKIP'
'0a11d7149da210a31ef88f8a9c717711'
'7ca3b5244bb092d46f5bcf1e2bdf4a18'
'f7df0df8c1d2da279e48d0fdc984fb71')
'f7df0df8c1d2da279e48d0fdc984fb71'
'67ae9735c283637ef6d11b17a3f81953')
validpgpkeys=(4B71379A9D5263D112A85620A5A4E99C711D3B61)
prepare() {
......@@ -37,9 +40,11 @@ prepare() {
patch -Np1 -i "$srcdir"/openbox-3.5.0-title-matching.patch # OB#5277
patch -Np1 -i "$srcdir"/openbox-3.5.0-which-2.20.patch # FS#11455
patch -Np1 -i "$srcdir"/$pkgname-kde-paths.patch # FS#64139
# modified from https://github.com/troycurtisjr/openbox/commit/acfbbc4ea40932f183617bb7006700140fe5f61e
patch -Np1 -i "$srcdir"/py3.patch
sed -i 's|/usr/bin/env python|/usr/bin/env python2|' \
data/autostart/openbox-xdg-autostart
# py3.patch modifies configure.ac
autoreconf -ifv
}
build() {
......
py3.patch 0 → 100644
From acfbbc4ea40932f183617bb7006700140fe5f61e Mon Sep 17 00:00:00 2001
From: Troy Curtis Jr <troycurtisjr@gmail.com>
Date: Wed, 13 Sep 2017 21:59:48 -0500
Subject: [PATCH] Add python3 support to openbox-xdg-autostart.
Updated syntax in openbox-xdg-autostart to support both python2 and
python3.
Added a configure substitution to set the choosen python at build time.
https://bugzilla.icculus.org/show_bug.cgi?id=6444
---
.gitignore | 1 +
configure.ac | 3 +
...xdg-autostart => openbox-xdg-autostart.in} | 70 +++++++++----------
3 files changed, 38 insertions(+), 36 deletions(-)
rename data/autostart/{openbox-xdg-autostart => openbox-xdg-autostart.in} (77%)
diff --git a/configure.ac b/configure.ac
index ca1602670..9a31e9845 100644
--- a/configure.ac
+++ b/configure.ac
@@ -103,6 +103,8 @@ AC_CHECK_HEADERS(ctype.h dirent.h errno.h fcntl.h grp.h locale.h pwd.h)
AC_CHECK_HEADERS(signal.h string.h stdio.h stdlib.h unistd.h sys/stat.h)
AC_CHECK_HEADERS(sys/select.h sys/socket.h sys/time.h sys/types.h sys/wait.h)
+AM_PATH_PYTHON([2],,)
+
AC_PATH_PROG([SED], [sed], [no])
if test "$SED" = "no"; then
AC_MSG_ERROR([The program "sed" is not available. This program is required to build Openbox.])
@@ -259,6 +261,7 @@ AC_CONFIG_FILES([
obrender/version.h
obt/version.h
version.h
+ data/autostart/openbox-xdg-autostart
])
AC_CONFIG_COMMANDS([doc],
[test -d doc || mkdir doc])
diff --git a/data/autostart/openbox-xdg-autostart b/data/autostart/openbox-xdg-autostart.in
similarity index 77%
rename from data/autostart/openbox-xdg-autostart
rename to data/autostart/openbox-xdg-autostart.in
index 04a17a199..3c365b112 100755
--- a/data/autostart/openbox-xdg-autostart
+++ b/data/autostart/openbox-xdg-autostart.in
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!@PYTHON@
# openbox-xdg-autostart runs things based on the XDG autostart specification
# Copyright (C) 2008 Dana Jansens
@@ -28,9 +28,7 @@ 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
+ sys.stderr.write("\nERROR: %s requires PyXDG to be installed\n" % ME)
sys.exit(1)
def main(argv=sys.argv):
@@ -51,7 +49,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 +97,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 +144,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 +163,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())
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment