qtile: 0.13.0 -> 0.16.0 (#93705)

* qtile: 0.13.0 -> 0.16.0

* qtile: refactoring to use setuptools_scm solution used in other places in nixpkgs
This commit is contained in:
deliciouslytyped 2020-07-25 17:51:57 +02:00 committed by GitHub
parent 56fcf7891b
commit c45f9a1e70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 58 additions and 44 deletions

View File

@ -1,25 +1,8 @@
diff --git a/libqtile/pangocffi.py b/libqtile/pangocffi.py
index 1e8f5c04..e860d43a 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 f1133555..3e61204a 100644
--- a/libqtile/xcursors.py
+++ b/libqtile/xcursors.py
@@ -112,7 +112,7 @@ class Cursors(dict):
diff --git a/libqtile/backend/x11/xcursors.py b/libqtile/backend/x11/xcursors.py
index 24454b83..ef37875c 100644
--- a/libqtile/backend/x11/xcursors.py
+++ b/libqtile/backend/x11/xcursors.py
@@ -107,7 +107,7 @@ class Cursors(dict):
def _setup_xcursor_binding(self):
try:
@ -28,3 +11,21 @@ index f1133555..3e61204a 100644
except OSError:
logger.warning("xcb-cursor not found, fallback to font pointer")
return False
diff --git a/libqtile/pangocffi.py b/libqtile/pangocffi.py
index dbae27ed..54c2c35f 100644
--- a/libqtile/pangocffi.py
+++ b/libqtile/pangocffi.py
@@ -52,10 +52,9 @@ try:
except ImportError:
raise ImportError("No module named libqtile._ffi_pango, be sure to run `./scripts/ffibuild`")
-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 patch_cairo_context(cairo_t):
def create_layout():

View File

@ -1,5 +1,5 @@
diff --git a/bin/qshell b/bin/qshell
index 2ba7e61c..0ac2a2ef 100755
index 5c652b7a..2d169eb2 100755
--- a/bin/qshell
+++ b/bin/qshell
@@ -28,5 +28,6 @@ base_dir = os.path.abspath(os.path.join(this_dir, ".."))
@ -10,7 +10,7 @@ index 2ba7e61c..0ac2a2ef 100755
from libqtile.scripts import qshell
qshell.main()
diff --git a/bin/qtile b/bin/qtile
index 3e82814d..335b5cea 100755
index ebc8fab5..08a965ef 100755
--- a/bin/qtile
+++ b/bin/qtile
@@ -29,5 +29,6 @@ base_dir = os.path.abspath(os.path.join(this_dir, ".."))
@ -20,8 +20,19 @@ index 3e82814d..335b5cea 100755
+ __import__("importlib").import_module("libqtile.utils").restore_os_environment()
from libqtile.scripts import qtile
qtile.main()
diff --git a/bin/qtile-cmd b/bin/qtile-cmd
index a2136ee6..3d37a6d9 100755
--- a/bin/qtile-cmd
+++ b/bin/qtile-cmd
@@ -8,5 +8,6 @@ base_dir = os.path.abspath(os.path.join(this_dir, ".."))
sys.path.insert(0, base_dir)
if __name__ == '__main__':
+ __import__("importlib").import_module("libqtile.utils").restore_os_environment()
from libqtile.scripts import qtile_cmd
qtile_cmd.main()
diff --git a/bin/qtile-run b/bin/qtile-run
index e4b121be..1c203bc9 100755
index ac4cb1fd..74c589cb 100755
--- a/bin/qtile-run
+++ b/bin/qtile-run
@@ -8,5 +8,6 @@ base_dir = os.path.abspath(os.path.join(this_dir, ".."))
@ -32,7 +43,7 @@ index e4b121be..1c203bc9 100755
from libqtile.scripts import qtile_run
qtile_run.main()
diff --git a/bin/qtile-top b/bin/qtile-top
index 5316e0e7..272c6430 100755
index a6251f27..0d524b1d 100755
--- a/bin/qtile-top
+++ b/bin/qtile-top
@@ -8,5 +8,6 @@ base_dir = os.path.abspath(os.path.join(this_dir, ".."))
@ -43,14 +54,13 @@ index 5316e0e7..272c6430 100755
from libqtile.scripts import qtile_top
qtile_top.main()
diff --git a/libqtile/utils.py b/libqtile/utils.py
index 550ed02677e..1358a66f3df 100644
index 2628c898..05117be7 100644
--- a/libqtile/utils.py
+++ b/libqtile/utils.py
@@ -272,3 +272,11 @@ def safe_import(module_names, class_name, globals_, fallback=None):
logger.debug("%s", traceback.format_exc())
if fallback:
globals_[class_name] = fallback(module_path, class_name, error)
+
@@ -270,3 +270,10 @@ def guess_terminal():
return terminal
logger.error('Default terminal has not been found.')
+
+def restore_os_environment():
+ pythonpath = os.environ.pop("QTILE_SAVED_PYTHONPATH", "")
@ -58,3 +68,4 @@ index 550ed02677e..1358a66f3df 100644
+ path = os.environ.pop("QTILE_SAVED_PATH", None)
+ if path:
+ os.environ["PATH"] = path

View File

@ -1,8 +1,8 @@
diff --git a/libqtile/manager.py b/libqtile/manager.py
index fc198e9bae7..860b97d8db1 100644
--- a/libqtile/manager.py
+++ b/libqtile/manager.py
@@ -1402,7 +1402,7 @@ class Qtile(command.CommandObject):
diff --git a/libqtile/core/manager.py b/libqtile/core/manager.py
index c22eeb6a..2ffe4eab 100644
--- a/libqtile/core/manager.py
+++ b/libqtile/core/manager.py
@@ -278,7 +278,7 @@ class Qtile(CommandObject):
logger.error("Unable to pickle qtile state")
argv = [s for s in argv if not s.startswith('--with-state')]
argv.append('--with-state=' + buf.getvalue().decode())
@ -10,4 +10,4 @@ index fc198e9bae7..860b97d8db1 100644
+ self._restart = (os.environ.get("QTILE_WRAPPER", "@out@/bin/qtile"), argv[1:])
self.stop()
def cmd_spawn(self, cmd):
async def finalize(self):

View File

@ -7,13 +7,13 @@ in
python37Packages.buildPythonApplication rec {
name = "qtile-${version}";
version = "0.13.0";
version = "0.16.0";
src = fetchFromGitHub {
owner = "qtile";
repo = "qtile";
rev = "v${version}";
sha256 = "1lyclnn8hs6wl4w9v5b4hh2q0pvmsn7cyibpskhbpw0cgv7bvi90";
sha256 = "1klv1k9847nyx71sfrhqyl1k51k2w8phqnp2bns4dvbqii7q125l";
};
patches = [
@ -23,16 +23,18 @@ python37Packages.buildPythonApplication rec {
];
postPatch = ''
substituteInPlace libqtile/manager.py --subst-var-by out $out
substituteInPlace libqtile/core/manager.py --subst-var-by out $out
substituteInPlace libqtile/pangocffi.py --subst-var-by glib ${glib.out}
substituteInPlace libqtile/pangocffi.py --subst-var-by pango ${pango.out}
substituteInPlace libqtile/xcursors.py --subst-var-by xcb-cursor ${xcbutilcursor.out}
substituteInPlace libqtile/backend/x11/xcursors.py --subst-var-by xcb-cursor ${xcbutilcursor.out}
'';
SETUPTOOLS_SCM_PRETEND_VERSION = version;
nativeBuildInputs = [ pkgconfig ];
buildInputs = [ glib libxcb cairo pango python37Packages.xcffib ];
pythonPath = with python37Packages; [ xcffib cairocffi-xcffib setuptools ];
pythonPath = with python37Packages; [ xcffib cairocffi-xcffib setuptools setuptools_scm ];
postInstall = ''
wrapProgram $out/bin/qtile \
@ -41,7 +43,7 @@ python37Packages.buildPythonApplication rec {
--run 'export QTILE_SAVED_PATH=$PATH'
'';
doCheck = false; # Requires X server.
doCheck = false; # Requires X server #TODO this can be worked out with the existing NixOS testing infrastructure.
meta = with stdenv.lib; {
homepage = "http://www.qtile.org/";