From f451a8e80cf8d2da08bb65c4c07e3d41d7a17e58 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Fri, 13 May 2022 15:19:31 -0400 Subject: gnu: openbox: Patch for Python 3. * gnu/packages/patches/openbox-python3.patch: New patch. * gnu/local.mk (dist_patch_DATA): Register it. * gnu/packages/openbox.scm (openbox)[source]: Apply it. [arguments]: New field. [propagated-inputs]: Replace python2-pyxdg with python-pyxdg. [native-inputs]: Replace python-2 with python-wrapper. Add autoconf, automake, gettext-minimal and libtool. --- gnu/local.mk | 1 + gnu/packages/openbox.scm | 20 +++- gnu/packages/patches/openbox-python3.patch | 165 +++++++++++++++++++++++++++++ 3 files changed, 182 insertions(+), 4 deletions(-) create mode 100644 gnu/packages/patches/openbox-python3.patch diff --git a/gnu/local.mk b/gnu/local.mk index 06cf32b916..af92253ddd 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1561,6 +1561,7 @@ dist_patch_DATA = \ %D%/packages/patches/onnx-skip-model-downloads.patch \ %D%/packages/patches/openboardview-use-system-imgui.patch \ %D%/packages/patches/openboardview-use-system-utf8.patch \ + %D%/packages/patches/openbox-python3.patch \ %D%/packages/patches/opencascade-oce-glibc-2.26.patch \ %D%/packages/patches/openfoam-4.1-cleanup.patch \ %D%/packages/patches/openjdk-10-idlj-reproducibility.patch \ diff --git a/gnu/packages/openbox.scm b/gnu/packages/openbox.scm index 873592c19e..2dac9ec644 100644 --- a/gnu/packages/openbox.scm +++ b/gnu/packages/openbox.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2014 Julien Lepiller ;;; Copyright © 2016 Efraim Flashner ;;; Copyright © 2017 Nikita +;;; Copyright © 2022 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -24,6 +25,9 @@ #:use-module (guix download) #:use-module (guix utils) #:use-module (guix build-system gnu) + #:use-module (guix gexp) + #:use-module (gnu packages) + #:use-module (gnu packages autotools) #:use-module (gnu packages freedesktop) #:use-module (gnu packages gettext) #:use-module (gnu packages gnome) @@ -46,10 +50,18 @@ version ".tar.xz")) (sha256 (base32 - "0vg2y1qddsdxkjv806mzpvmkgzliab8ll4s7zm7ma5jnriamirxb")))) + "0vg2y1qddsdxkjv806mzpvmkgzliab8ll4s7zm7ma5jnriamirxb")) + (patches (search-patches "openbox-python3.patch")))) (build-system gnu-build-system) - (native-inputs (list pkg-config)) - (propagated-inputs (list python2-pyxdg)) + (arguments + (list #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'force-reconfigure + ;; This is made necessary by the openbox-python3 patch. + (lambda _ + (delete-file "configure")))))) + (native-inputs (list autoconf automake gettext-minimal libtool pkg-config)) + (propagated-inputs (list python-pyxdg)) (inputs (list imlib2 libxml2 (librsvg-for-system) @@ -60,7 +72,7 @@ libxrandr libxft pango - python-2)) + python-wrapper)) (synopsis "Box style window manager") (description "Openbox is a highly configurable, next generation window manager with diff --git a/gnu/packages/patches/openbox-python3.patch b/gnu/packages/patches/openbox-python3.patch new file mode 100644 index 0000000000..782524d8a7 --- /dev/null +++ b/gnu/packages/patches/openbox-python3.patch @@ -0,0 +1,165 @@ +Retrieved from the openbox Debian package. + +From acfbbc4ea40932f183617bb7006700140fe5f61e Mon Sep 17 00:00:00 2001 +From: Troy Curtis Jr +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 chosen 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()) -- cgit v1.2.3