Files
nixpkgs/pkgs/development/python-modules/i3ipc/default.nix
T
quantenzitrone 7d8132a92c treewide: remove references to the xorg namespace in pkgs (automated)
this creates some eval errors that will be fixed in the next commit

done with the following script:

```fish
\#!/usr/bin/env fish

set packagesjson (nix eval --impure --json --expr '
let
  lib = import ./lib;
in
import pkgs/servers/x11/xorg/default.nix (lib.mapAttrs (
  name: _:
  if name == "lib" then
    lib
  else if name == "config" then
    { allowAliases = false; }
  else
    name
) (__functionArgs (import pkgs/servers/x11/xorg/default.nix))) { }
' | jq)

set one (grep '^    [A-Za-z0-9_-]*$' pkgs/servers/x11/xorg/default.nix | string trim | string replace -r '$' Z | sort | string sub -e -1)
set two (grep '^  [A-Za-z0-9_-]* = [A-Za-z0-9_-]*;$' pkgs/servers/x11/xorg/default.nix | cut -d= -f1 | string trim | string replace -r '$' Z | sort | string sub -e -1)

for arg in $one $two
    set oname $arg
    set nname (echo $packagesjson | jq -r .$oname)

    if test $nname = null
        echo (set_color red)warn:(set_color normal) unknown package xorg.$oname >&2
        continue
    end

    echo $oname "->" $nname

    # replace basic xorg.$name references
    for file in (rg -F "xorg.$oname" --files-with-matches pkgs)
        # special cases
        sd -F "$oname = xorg.$oname;" "$nname = $nname;" $file

        # replace
        sd -F "xorg.$oname" "$nname" $file

        # fixup function arguments

        # prevent duplicate function args
        if grep -E " ($oname|$nname),\$" $file >/dev/null
            continue
        end

        if grep 'xorg\..' $file >/dev/null # case1: there is more so we can't just remove the function arg

            if grep ' xorg,$' $file >/dev/null
                sd ' xorg,$' " xorg,
                $nname," $file

            else if grep ' xorg ? .*,$' $file >/dev/null
                sd 'xorg( ? .*),$' "xorg\$1,
                $nname," $file

            else
                sd -F 'xorg,' "$nname,
                xorg," $file
            end

        else # case there is no more xorg..* so we can just replace the function arg
            sd 'xorg(| ? .*),.*$' "$nname," $file
        end
    end
end

nix fmt
```
2026-01-25 22:28:09 +01:00

78 lines
1.8 KiB
Nix

{
lib,
buildPythonPackage,
fetchFromGitHub,
coreutils,
setuptools,
xlib,
fontconfig,
pytestCheckHook,
writableTmpDirAsHomeHook,
pytest-asyncio,
pytest-timeout,
pytest-xvfb,
i3,
xvfb,
xdpyinfo,
}:
buildPythonPackage rec {
pname = "i3ipc";
version = "2.2.1";
pyproject = true;
src = fetchFromGitHub {
owner = "altdesktop";
repo = "i3ipc-python";
tag = "v${version}";
hash = "sha256-JRwipvIF1zL/x2A+xEJKEFV6BlDnv2Xt/eyIzVrSf40=";
};
patches = [
# Upstream expects a very old version of pytest-asyncio. This patch correctly
# decorates async fixtures using pytest-asyncio and configures `loop_scope`
# where needed.
./fix-async-tests.patch
];
postPatch = ''
substituteInPlace test/i3.config \
--replace-fail /bin/true ${coreutils}/bin/true
'';
build-system = [ setuptools ];
dependencies = [ xlib ];
# Fontconfig error: Cannot load default config file
env.FONTCONFIG_FILE = "${fontconfig.out}/etc/fonts/fonts.conf";
nativeCheckInputs = [
pytestCheckHook
writableTmpDirAsHomeHook
pytest-asyncio
pytest-timeout
pytest-xvfb
i3
xdpyinfo
xvfb
];
disabledTestPaths = [
# Timeout
"test/test_shutdown_event.py::TestShutdownEvent::test_shutdown_event_reconnect"
"test/aio/test_shutdown_event.py::TestShutdownEvent::test_shutdown_event_reconnect"
# Flaky
"test/test_window.py::TestWindow::test_detailed_window_event"
"test/aio/test_workspace.py::TestWorkspace::test_workspace"
];
pythonImportsCheck = [ "i3ipc" ];
meta = {
description = "Improved Python library to control i3wm and sway";
homepage = "https://github.com/altdesktop/i3ipc-python";
changelog = "https://github.com/altdesktop/i3ipc-python/releases/tag/${src.tag}";
license = lib.licenses.bsd3;
};
}