Commit a4f91607 authored by Fabian Affolter's avatar Fabian Affolter
Browse files

rich-cli: add patches to support later rich/textual releases

parent dc88b850
Loading
Loading
Loading
Loading
+28 −43
Original line number Diff line number Diff line
{ 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 = [