summaryrefslogtreecommitdiffstats
path: root/pkgs/applications/window-managers/qtile
diff options
context:
space:
mode:
authorLuca Bruno <lethalman88@gmail.com>2015-12-11 18:31:00 +0100
committerLuca Bruno <lethalman88@gmail.com>2015-12-11 18:31:00 +0100
commit5b0352a6a43fdd924a53cde4b81c15b755fa0a27 (patch)
treecf0fcc2be2f6d08c970f0322a63ff0a31d5d5dee /pkgs/applications/window-managers/qtile
parent2f0fe05543ce594eacf0310966914d6e19a42f88 (diff)
parent146784f835a6cadc65812c5adf76533c18e5be61 (diff)
Merge branch 'master' into closure-size
Diffstat (limited to 'pkgs/applications/window-managers/qtile')
-rw-r--r--pkgs/applications/window-managers/qtile/0001-Substitution-vars-for-absolute-paths.patch43
-rw-r--r--pkgs/applications/window-managers/qtile/0002-Restore-PATH-and-PYTHONPATH.patch67
-rw-r--r--pkgs/applications/window-managers/qtile/0003-Restart-executable.patch25
-rw-r--r--pkgs/applications/window-managers/qtile/default.nix28
-rw-r--r--pkgs/applications/window-managers/qtile/restart_executable.patch12
5 files changed, 152 insertions, 23 deletions
diff --git a/pkgs/applications/window-managers/qtile/0001-Substitution-vars-for-absolute-paths.patch b/pkgs/applications/window-managers/qtile/0001-Substitution-vars-for-absolute-paths.patch
new file mode 100644
index 000000000000..e3c88a5fa551
--- /dev/null
+++ b/pkgs/applications/window-managers/qtile/0001-Substitution-vars-for-absolute-paths.patch
@@ -0,0 +1,43 @@
+From 00c5af939567429d40877845dc52b54fde2d8a50 Mon Sep 17 00:00:00 2001
+From: "Alexander V. Nikolaev" <avn@avnik.info>
+Date: Thu, 26 Nov 2015 10:53:12 +0200
+Subject: [PATCH 1/3] Substitution vars for absolute paths
+
+---
+ libqtile/pangocffi.py | 6 +++---
+ libqtile/xcursors.py | 2 +-
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/libqtile/pangocffi.py b/libqtile/pangocffi.py
+index 27691d1..25f690d 100644
+--- a/libqtile/pangocffi.py
++++ b/libqtile/pangocffi.py
+@@ -58,9 +58,9 @@ except ImportError:
+ else:
+ raise ImportError("No module named libqtile._ffi_pango, be sure to run `python ./libqtile/ffi_build.py`")
+
+-gobject = ffi.dlopen('libgobject-2.0.so.0')
+-pango = ffi.dlopen('libpango-1.0.so.0')
+-pangocairo = ffi.dlopen('libpangocairo-1.0.so.0')
++gobject = ffi.dlopen('@glib@/lib/libgobject-2.0.so.0')
++pango = ffi.dlopen('@pango@/lib/libpango-1.0.so.0')
++pangocairo = ffi.dlopen('@pango@/lib/libpangocairo-1.0.so.0')
+
+
+ def CairoContext(cairo_t):
+diff --git a/libqtile/xcursors.py b/libqtile/xcursors.py
+index e0e55e1..59b6428 100644
+--- a/libqtile/xcursors.py
++++ b/libqtile/xcursors.py
+@@ -114,7 +114,7 @@ class Cursors(dict):
+
+ def _setup_xcursor_binding(self):
+ try:
+- xcursor = ffi.dlopen('libxcb-cursor.so')
++ xcursor = ffi.dlopen('@xcb-cursor@/lib/libxcb-cursor.so')
+ except OSError:
+ self.log.warning("xcb-cursor not found, fallback to font pointer")
+ return False
+--
+2.6.3
+
diff --git a/pkgs/applications/window-managers/qtile/0002-Restore-PATH-and-PYTHONPATH.patch b/pkgs/applications/window-managers/qtile/0002-Restore-PATH-and-PYTHONPATH.patch
new file mode 100644
index 000000000000..ba408b1f05bb
--- /dev/null
+++ b/pkgs/applications/window-managers/qtile/0002-Restore-PATH-and-PYTHONPATH.patch
@@ -0,0 +1,67 @@
+From f299a0aa0eefcf16bb4990f00ac3946727f43ef3 Mon Sep 17 00:00:00 2001
+From: "Alexander V. Nikolaev" <avn@avnik.info>
+Date: Fri, 27 Nov 2015 10:49:48 +0200
+Subject: [PATCH 2/3] Restore PATH and PYTHONPATH
+
+---
+ bin/qtile | 1 +
+ bin/qtile-run | 1 +
+ bin/qtile-session | 2 ++
+ libqtile/utils.py | 7 +++++++
+ 4 files changed, 11 insertions(+)
+
+diff --git a/bin/qtile b/bin/qtile
+index 66034fe..ce3fcd1 100755
+--- a/bin/qtile
++++ b/bin/qtile
+@@ -131,6 +131,7 @@ def make_qtile():
+
+
+ if __name__ == "__main__":
++ __import__("importlib").import_module("libqtile.utils").restore_os_environment()
+ rename_process()
+ q = make_qtile()
+ try:
+diff --git a/bin/qtile-run b/bin/qtile-run
+index ccedb96..646a476 100755
+--- a/bin/qtile-run
++++ b/bin/qtile-run
+@@ -50,6 +50,7 @@ def main():
+ proc.wait()
+
+ if __name__ == "__main__":
++ __import__("importlib").import_module("libqtile.utils").restore_os_environment()
+ try:
+ main()
+ except KeyboardInterrupt:
+diff --git a/bin/qtile-session b/bin/qtile-session
+index 84f6a2d..da31b12 100755
+--- a/bin/qtile-session
++++ b/bin/qtile-session
+@@ -25,6 +25,8 @@
+ Qtile session manager.
+ """
+
++__import__("importlib").import_module("libqtile.utils").restore_os_environment()
++
+ from libqtile.log_utils import init_log
+ import logging
+ import os
+diff --git a/libqtile/utils.py b/libqtile/utils.py
+index d5f975b..0fdb080 100644
+--- a/libqtile/utils.py
++++ b/libqtile/utils.py
+@@ -208,3 +208,10 @@ def get_cache_dir():
+ if not os.path.exists(cache_directory):
+ os.makedirs(cache_directory)
+ return cache_directory
++
++def restore_os_environment():
++ pythonpath = os.environ.pop("QTILE_SAVED_PYTHONPATH", "")
++ os.environ["PYTHONPATH"] = pythonpath
++ path = os.environ.pop("QTILE_SAVED_PATH", None)
++ if path:
++ os.environ["PATH"] = path
+--
+2.6.3
+
diff --git a/pkgs/applications/window-managers/qtile/0003-Restart-executable.patch b/pkgs/applications/window-managers/qtile/0003-Restart-executable.patch
new file mode 100644
index 000000000000..d9377897fc69
--- /dev/null
+++ b/pkgs/applications/window-managers/qtile/0003-Restart-executable.patch
@@ -0,0 +1,25 @@
+From b560c11078fecc35df2c62f34beda06c4e80a10d Mon Sep 17 00:00:00 2001
+From: "Alexander V. Nikolaev" <avn@avnik.info>
+Date: Fri, 27 Nov 2015 10:54:35 +0200
+Subject: [PATCH 3/3] Restart executable
+
+---
+ libqtile/manager.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libqtile/manager.py b/libqtile/manager.py
+index b1a38e2..110f7d8 100644
+--- a/libqtile/manager.py
++++ b/libqtile/manager.py
+@@ -1339,7 +1339,7 @@ class Qtile(command.CommandObject):
+ argv = [s for s in argv if not s.startswith('--with-state')]
+ argv.append('--with-state=' + buf.getvalue().decode())
+
+- self.cmd_execute(sys.executable, argv)
++ self.cmd_execute(os.environ.get("QTILE_WRAPPER", "@out@/bin/qtile"), argv[1:])
+
+ def cmd_spawn(self, cmd):
+ """
+--
+2.6.3
+
diff --git a/pkgs/applications/window-managers/qtile/default.nix b/pkgs/applications/window-managers/qtile/default.nix
index 1043e3a1f64b..82ff3900cc41 100644
--- a/pkgs/applications/window-managers/qtile/default.nix
+++ b/pkgs/applications/window-managers/qtile/default.nix
@@ -1,5 +1,10 @@
{ stdenv, lib, fetchFromGitHub, buildPythonPackage, python27Packages, pkgs }:
+let cairocffi-xcffib = python27Packages.cairocffi.override {
+ pythonPath = [ python27Packages.xcffib ];
+ };
+in
+
buildPythonPackage rec {
name = "qtile-${version}";
version = "0.10.2";
@@ -11,27 +16,28 @@ buildPythonPackage rec {
sha256 = "0dhdwjr4pdlzli68fa8glrnsjzxp6agdab9cnmpsqlwiwh97x9a6";
};
- patches = [ ./restart_executable.patch ];
+ patches = [
+ ./0001-Substitution-vars-for-absolute-paths.patch
+ ./0002-Restore-PATH-and-PYTHONPATH.patch
+ ./0003-Restart-executable.patch
+ ];
postPatch = ''
substituteInPlace libqtile/manager.py --subst-var-by out $out
+ substituteInPlace libqtile/pangocffi.py --subst-var-by glib ${pkgs.glib}
+ substituteInPlace libqtile/pangocffi.py --subst-var-by pango ${pkgs.pango}
+ substituteInPlace libqtile/xcursors.py --subst-var-by xcb-cursor ${pkgs.xorg.xcbutilcursor}
'';
buildInputs = [ pkgs.pkgconfig pkgs.glib pkgs.xorg.libxcb pkgs.cairo pkgs.pango python27Packages.xcffib ];
- cairocffi-xcffib = python27Packages.cairocffi.override {
- inherit LD_LIBRARY_PATH;
- pythonPath = [ python27Packages.xcffib ];
- };
-
- pythonPath = with python27Packages; [ xcffib cairocffi-xcffib trollius readline ];
-
- LD_LIBRARY_PATH = "${lib.makeLibraryPath [ pkgs.xorg.libxcb pkgs.cairo ]}";
+ pythonPath = with python27Packages; [ xcffib cairocffi-xcffib trollius readline];
postInstall = ''
wrapProgram $out/bin/qtile \
- --prefix LD_LIBRARY_PATH : \
- "${LD_LIBRARY_PATH}:${lib.makeLibraryPath [ pkgs.glib pkgs.pango ]}"
+ --set QTILE_WRAPPER '"$0"' \
+ --set QTILE_SAVED_PYTHONPATH '"$PYTHONPATH"' \
+ --set QTILE_SAVED_PATH '"$PATH"'
'';
meta = with stdenv.lib; {
diff --git a/pkgs/applications/window-managers/qtile/restart_executable.patch b/pkgs/applications/window-managers/qtile/restart_executable.patch
deleted file mode 100644
index a1e74a575d9e..000000000000
--- a/pkgs/applications/window-managers/qtile/restart_executable.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -ruP a/libqtile/manager.py b/libqtile/manager.py
---- a/libqtile/manager.py 2015-07-26 21:26:16.947976520 +0200
-+++ b/libqtile/manager.py 2015-07-26 21:37:45.581316712 +0200
-@@ -1262,7 +1262,7 @@
- argv = [s for s in argv if not s.startswith('--with-state')]
- argv.append('--with-state=' + buf.getvalue().decode())
-
-- self.cmd_execute(sys.executable, argv)
-+ self.cmd_execute("@out@/bin/qtile", argv[1:])
-
- def cmd_spawn(self, cmd):
- """