From a4f916072fbb9991427c0056aff4c95ed0a3ebb0 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Wed, 22 May 2024 15:28:48 +0200 Subject: [PATCH] rich-cli: add patches to support later rich/textual releases --- pkgs/misc/rich-cli/default.nix | 71 ++++++++++++++-------------------- 1 file changed, 28 insertions(+), 43 deletions(-) diff --git a/pkgs/misc/rich-cli/default.nix b/pkgs/misc/rich-cli/default.nix index 9d03cfc66917..b6cf7684c44d 100644 --- a/pkgs/misc/rich-cli/default.nix +++ b/pkgs/misc/rich-cli/default.nix @@ -1,68 +1,53 @@ { lib , fetchFromGitHub +, fetchpatch , python3 }: -let - py = python3.override { - packageOverrides = final: prev: { - rich = prev.rich.overridePythonAttrs (old: rec { - version = "12.4.0"; - src = fetchFromGitHub { - owner = "Textualize"; - repo = "rich"; - rev = "refs/tags/v12.4.0"; - hash = "sha256-ryJTusUNpvNF2031ICJWK8ScxHIh+LrXYg7nd0ph4aQ="; - }; - propagatedBuildInputs = with py.pkgs; [ - commonmark - pygments - ]; - doCheck = false; - }); - - textual = prev.textual.overridePythonAttrs (old: rec { - version = "0.1.18"; - src = fetchFromGitHub { - owner = "Textualize"; - repo = "textual"; - rev = "refs/tags/v0.1.18"; - hash = "sha256-XVmbt8r5HL8r64ISdJozmM+9HuyvqbpdejWICzFnfiw="; - }; - doCheck = false; - }); - }; - }; -in - python3.pkgs.buildPythonApplication rec { pname = "rich-cli"; version = "1.8.0"; - format = "pyproject"; + pyproject = true; src = fetchFromGitHub { owner = "Textualize"; - repo = pname; + repo = "rich-cli"; rev = "refs/tags/v${version}"; hash = "sha256-mV5b/J9wX9niiYtlmAUouaAm9mY2zTtDmex7FNWcezQ="; }; - postPatch = '' - substituteInPlace pyproject.toml \ - --replace 'rich = "^12.4.0"' 'rich = "*"' \ - --replace 'textual = "^0.1.18"' 'textual = "*"' - ''; + patches = [ + # Update dependencies, https://github.com/Textualize/rich-cli/pull/94 + (fetchpatch { + name = "update-dependencies.patch"; + url = "https://github.com/Textualize/rich-cli/pull/94/commits/1e9a11af7c1c78a5a44a207b1e0dce4c4b3c39f0.patch"; + hash = "sha256-cU+s/LK2GDVWXLZob0n5J6sLjflCr8w10hRLgeWN5Vg="; + }) + (fetchpatch { + name = "markdown.patch"; + url = "https://github.com/Textualize/rich-cli/pull/94/commits/0a8e77d724ace88ce88ee9d68a46b1dc8464fe0b.patch"; + hash = "sha256-KXvRG36Qj5kCj1RiAJsNkoJY7t41zUfJFgHeCtc0O4w="; + }) + ]; - nativeBuildInputs = with py.pkgs; [ + pythonRelaxDeps = [ + "textual" + ]; + + build-system = with python3.pkgs; [ poetry-core ]; - propagatedBuildInputs = with py.pkgs; [ - rich + nativeBuildInputs = with python3.pkgs; [ + pythonRelaxDepsHook + ]; + + dependencies = with python3.pkgs; [ click requests - textual + rich rich-rst + textual ]; pythonImportsCheck = [