From dda852d7d083ed5ac9a80efe0fe42ca926cb4dce Mon Sep 17 00:00:00 2001 From: isaackwy Date: Tue, 12 Nov 2024 14:10:48 -0800 Subject: [PATCH] desktop/qtile: Update for 0.29.0 --- desktop/qtile/README | 3 +- desktop/qtile/python3.9_fixes.patch | 200 ++++++++++++++++++++++++++++ desktop/qtile/qtile.SlackBuild | 7 +- desktop/qtile/qtile.info | 6 +- 4 files changed, 210 insertions(+), 6 deletions(-) create mode 100644 desktop/qtile/python3.9_fixes.patch diff --git a/desktop/qtile/README b/desktop/qtile/README index a41008c12aa..68d668928b7 100644 --- a/desktop/qtile/README +++ b/desktop/qtile/README @@ -3,8 +3,7 @@ Wayland) written and configured in Python. Qtile is simple, small, and extensible - it is easy to write your own layouts, widgets and built-in commands. -You will need to build python3-cairocffi with its optional -python3-xcffib dependency. +python3-xcffib must be installed before python3-cairocffi. python3-dbus-next is an optional dependency for qtile. It sends notifications through dbus - please additionally install a diff --git a/desktop/qtile/python3.9_fixes.patch b/desktop/qtile/python3.9_fixes.patch new file mode 100644 index 00000000000..1e78e9435e3 --- /dev/null +++ b/desktop/qtile/python3.9_fixes.patch @@ -0,0 +1,200 @@ +--- a/libqtile/backend/base/window.py ++++ b/libqtile/backend/base/window.py +@@ -581,4 +581,4 @@ + ) + + +-WindowType = Window | Internal | Static ++WindowType = typing.Union[Window, Internal, Static] +--- a/libqtile/backend/wayland/core.py ++++ b/libqtile/backend/wayland/core.py +@@ -868,7 +868,7 @@ + logger.debug("Signal: idle_inhibitor new_inhibitor") + + for win in self.qtile.windows_map.values(): +- if isinstance(win, window.Window | window.Static): ++ if isinstance(win, (window.Window, window.Static)): + win.surface.for_each_surface(win.add_idle_inhibitor, idle_inhibitor) + if idle_inhibitor.data: + # We break if the .data attribute was set, because that tells us +--- a/libqtile/backend/wayland/window.py ++++ b/libqtile/backend/wayland/window.py +@@ -1113,7 +1113,7 @@ + self.tree.node.raise_to_top() + + +-WindowType = Window | Static | Internal ++WindowType = typing.Union[Window, Static, Internal] + + + class PointerConstraint(HasListeners): +--- a/libqtile/bar.py ++++ b/libqtile/bar.py +@@ -767,4 +767,4 @@ + self.window.keep_above(enable=True) + + +-BarType = Bar | Gap ++BarType = typing.Union[Bar, Gap] +--- a/libqtile/command/graph.py ++++ b/libqtile/command/graph.py +@@ -26,7 +26,7 @@ + from __future__ import annotations + + import abc +-from typing import TYPE_CHECKING ++from typing import TYPE_CHECKING, Union + + if TYPE_CHECKING: + SelectorType = tuple[str, str | int | None] +@@ -218,4 +218,4 @@ + } + + +-GraphType = CommandGraphNode | CommandGraphCall ++GraphType = Union[CommandGraphNode, CommandGraphCall] +--- a/libqtile/core/manager.py ++++ b/libqtile/core/manager.py +@@ -1417,7 +1417,7 @@ + return [ + i.info() + for i in self.windows_map.values() +- if not isinstance(i, base.Internal | _Widget) and isinstance(i, CommandObject) ++ if not isinstance(i, (base.Internal, _Widget)) and isinstance(i, CommandObject) + ] + + @expose_command() +--- a/libqtile/layout/screensplit.py ++++ b/libqtile/layout/screensplit.py +@@ -43,10 +43,10 @@ + self, *, name: str, rect: Rect, layout: Layout, matches: list[_Match] = list() + ) -> None: + # Check that rect is correctly defined +- if not isinstance(rect, tuple | list): ++ if not isinstance(rect, (tuple, list)): + raise ValueError("Split rect should be a list/tuple.") + +- if len(rect) != 4 or not all(isinstance(x, float | int) for x in rect): ++ if len(rect) != 4 or not all(isinstance(x, (float, int)) for x in rect): + raise ValueError("Split rect should have 4 float/int members.") + + if isinstance(layout, ScreenSplit): +--- a/libqtile/utils.py ++++ b/libqtile/utils.py +@@ -31,7 +31,7 @@ + from pathlib import Path + from random import randint + from shutil import which +-from typing import TYPE_CHECKING ++from typing import TYPE_CHECKING, Union + + try: + from dbus_next import AuthError, Message, Variant +@@ -44,8 +44,8 @@ + + from libqtile.log_utils import logger + +-ColorType = str | tuple[int, int, int] | tuple[int, int, int, float] +-ColorsType = ColorType | list[ColorType] ++ColorType = Union[str, tuple[int, int, int], tuple[int, int, int, float]] ++ColorsType = Union[ColorType, list[ColorType]] + if TYPE_CHECKING: + from collections.abc import Callable, Coroutine + from typing import Any, TypeVar +@@ -112,7 +112,7 @@ + + Which is returned as (1.0, 0.0, 0.0, 0.5). + """ +- if isinstance(x, tuple | list): ++ if isinstance(x, (tuple, list)): + if len(x) == 4: + alpha = x[-1] + else: +@@ -152,7 +152,7 @@ + Where a list of colours is passed, returns True if any + colour is not fully opaque. + """ +- if isinstance(colour, str | tuple): ++ if isinstance(colour, (str, tuple)): + return rgb(colour)[3] < 1 + return any(has_transparency(c) for c in colour) + +@@ -161,7 +161,7 @@ + """ + Returns a tuple of (r, g, b) with no alpha. + """ +- if isinstance(colour, str | tuple): ++ if isinstance(colour, (str, tuple)): + return tuple(x * 255.0 for x in rgb(colour)[:3]) + return [remove_transparency(c) for c in colour] + +--- a/libqtile/widget/base.py ++++ b/libqtile/widget/base.py +@@ -35,7 +35,7 @@ + import copy + import math + import subprocess +-from typing import TYPE_CHECKING ++from typing import TYPE_CHECKING, Union + + from libqtile import bar, configurable, confreader + from libqtile.command import interface +@@ -714,7 +714,7 @@ + @expose_command() + def set_font( + self, +- font: str | None = None, ++ font: Union[str, None] = None, + fontsize: int = 0, + fontshadow: ColorType = "", + ): +--- a/libqtile/widget/helpers/status_notifier/statusnotifier.py ++++ b/libqtile/widget/helpers/status_notifier/statusnotifier.py +@@ -23,6 +23,8 @@ + from pathlib import Path + + # dbus_next is incompatible with deferred type evaluation ++from typing import Optional ++ + import cairocffi + from dbus_next import InterfaceNotFoundError, InvalidBusNameError, InvalidObjectPathError + from dbus_next.aio import MessageBus +@@ -472,10 +474,10 @@ + self._items: list[str] = [] + self._hosts: list[str] = [] + self.service = service +- self.on_item_added: Callable | None = None +- self.on_host_added: Callable | None = None +- self.on_item_removed: Callable | None = None +- self.on_host_removed: Callable | None = None ++ self.on_item_added: Optional[Callable] = None ++ self.on_host_added: Optional[Callable] = None ++ self.on_item_removed: Optional[Callable] = None ++ self.on_host_removed: Optional[Callable] = None + + async def start(self): + # Set up and register the service on ths bus +@@ -616,9 +618,9 @@ + + async def start( + self, +- on_item_added: Callable | None = None, +- on_item_removed: Callable | None = None, +- on_icon_changed: Callable | None = None, ++ on_item_added: Optional[Callable] = None, ++ on_item_removed: Optional[Callable] = None, ++ on_icon_changed: Optional[Callable] = None, + ): + """ + Starts the host if not already started. +--- a/libqtile/widget/windowtabs.py ++++ b/libqtile/widget/windowtabs.py +@@ -50,7 +50,7 @@ + width = config.pop("width", bar.STRETCH) + base._TextBox.__init__(self, width=width, **config) + self.add_defaults(WindowTabs.defaults) +- if not isinstance(self.selected, tuple | list): ++ if not isinstance(self.selected, (tuple, list)): + self.selected = (self.selected, self.selected) + + def _configure(self, qtile, bar): diff --git a/desktop/qtile/qtile.SlackBuild b/desktop/qtile/qtile.SlackBuild index c9f953c731b..cf9eec9a988 100644 --- a/desktop/qtile/qtile.SlackBuild +++ b/desktop/qtile/qtile.SlackBuild @@ -26,7 +26,7 @@ cd $(dirname $0) ; CWD=$(pwd) PRGNAM=qtile -VERSION=${VERSION:-0.28.1} +VERSION=${VERSION:-0.29.0} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} PKGTYPE=${PKGTYPE:-tgz} @@ -66,6 +66,11 @@ find -L . \ PYVER=$(python3 -c 'import sys; print("%d.%d" % sys.version_info[:2])') export PYTHONPATH=/opt/python$PYVER/site-packages/ +# Fix TypeErrors (Slackware 15.0 has Python 3.9 installed) +# View the following commit for more details: +# https://github.com/qtile/qtile/commit/4ca8fd2fcac3bb1f076dc4ace5615b75e9e3cd92 +[[ $PYVER == 3.9 ]] && patch -p1 < $CWD/python3.9_fixes.patch + # qtile provides a setup.py - however, setuptools > 58.2.0 does not recommend running setup.py directly python3 -m build --no-isolation python3 -m installer -d "$PKG" dist/*.whl diff --git a/desktop/qtile/qtile.info b/desktop/qtile/qtile.info index 625c287a310..21252155216 100644 --- a/desktop/qtile/qtile.info +++ b/desktop/qtile/qtile.info @@ -1,8 +1,8 @@ PRGNAM="qtile" -VERSION="0.28.1" +VERSION="0.29.0" HOMEPAGE="http://qtile.org" -DOWNLOAD="https://files.pythonhosted.org/packages/source/q/qtile/qtile-0.28.1.tar.gz" -MD5SUM="ef53525da2b6f6e7fefef13c73f3d7ac" +DOWNLOAD="https://files.pythonhosted.org/packages/source/q/qtile/qtile-0.29.0.tar.gz" +MD5SUM="41e1895926cf45f42210c35227c88374" DOWNLOAD_x86_64="" MD5SUM_x86_64="" REQUIRES="python3-xcffib python3-cairocffi python3-setuptools-scm-opt"