Unverified Commit 046523e5 authored by dotlambda's avatar dotlambda Committed by GitHub
Browse files

shrinkray: 25.9.1-unstable-2025-09-11 → 26.1.1.0 (#483827)

parents 615fd647 fb245b31
Loading
Loading
Loading
Loading
+47 −12
Original line number Diff line number Diff line
{
  bash,
  black,
  clang-tools,
  coreutils,
  creduce,
  cvise,
  fetchFromGitHub,
  lib,
  minisat,
  python3,
}:

python3.pkgs.buildPythonApplication {
python3.pkgs.buildPythonApplication rec {
  pname = "shrinkray";
  version = "25.9.1-unstable-2025-09-11";
  version = "26.2.4.1";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "DRMacIver";
    repo = "shrinkray";
    rev = "21dac48cdb7f3a375a4ac5e5c782b7d4d3711d36";
    hash = "sha256-ef0vsWfLl0hJ7WfwInh++GAbw3qTZe8RAVNLxQCTNNs=";
    tag = "v${version}";
    hash = "sha256-y8NZJ80KM+wW58YAWT7Cx3uh08imI7sbs487GbANyJg=";
  };
  patches = [ ./tests-remove-black.patch ];
  postPatch = ''
    substituteInPlace tests/test_main.py \
      --replace-fail '/usr/bin/env' '${coreutils}/bin/env'
      --replace-fail '/usr/bin/env' '${lib.getExe' coreutils "env"}'
    substituteInPlace \
      tests/test_cli.py \
      tests/test_history.py \
      tests/test_main.py \
      tests/test_state.py \
      tests/test_subprocess_worker.py \
      tests/test_tui.py \
      tests/test_validation.py \
      --replace-fail '#!/bin/bash' '#!${lib.getExe bash}'
    substituteInPlace src/shrinkray/formatting.py \
      --replace-fail 'find_python_command("black")' '"${lib.getExe black}"' \
      --replace-fail 'which("clang-format")' '"${lib.getExe' clang-tools "clang-format"}"'
    substituteInPlace src/shrinkray/passes/clangdelta.py \
      --replace-fail 'which("clang_delta")' '"${cvise}/libexec/cvise/clang_delta"'
  '';

  build-system = [ python3.pkgs.setuptools ];
  propagatedBuildInputs = with python3.pkgs; [
  dependencies = with python3.pkgs; [
    click
    chardet
    trio
    urwid
    textual
    textual-plotext
    humanize
    libcst
    exceptiongroup
    binaryornot
  ];
  checkInputs = with python3.pkgs; [
  propagatedNativeBuildInputs = [
    black
    clang-tools
  ];
  nativeCheckInputs = [
    minisat
  ]
  ++ (with python3.pkgs; [
    hypothesis
    hypothesmith
    pytest-trio
    pytest-textual-snapshot
    pygments
  ];
  nativeCheckInputs = with python3.pkgs; [
    pexpect
    pyte
    pip
    pytestCheckHook
  ]);

  disabledTestPaths = [
    # Tests pretending these utilities are missing don't pass when we
    # patch in absolute paths
    "tests/test_clang_delta.py::test_find_clang_delta_when_found_in_path"
    "tests/test_clang_delta.py::test_find_clang_delta_when_not_found_anywhere"
    "tests/test_formatting.py::test_default_formatter_python_files_without_black"
  ];

  meta = {
+0 −34
Original line number Diff line number Diff line
diff --git a/tests/test_main.py b/tests/test_main.py
index ec6453e..a219750 100644
--- a/tests/test_main.py
+++ b/tests/test_main.py
@@ -5,16 +5,11 @@ import pathlib
 import pytest
 
 import trio
-import black
 from shrinkray.__main__ import interrupt_wait_and_kill, main
 from click.testing import CliRunner
 from attrs import define
 
 
-def format(s):
-    return black.format_str(s, mode=black.Mode()).strip()
-
-
 async def test_kill_process():
     async with trio.open_nursery() as nursery:
         kwargs = dict(
@@ -100,10 +95,8 @@ except AssertionError:
     assert not b.exists()
     assert c.exists()
 
-    # TODO: Remove calls to format when formatting is implemented properly for
-    # directories.
-    assert format(a.read_text()) == "x = 0"
-    assert format(c.read_text()) == "from a import x\n\nassert x"
+    assert a.read_text() == "x=0"
+    assert c.read_text() == "from\ta\timport\tx\nassert\tx"
 
 
 def test_gives_informative_error_when_script_does_not_work_outside_current_directory(
+38 −0
Original line number Diff line number Diff line
{
  buildPythonPackage,
  fetchPypi,
  lib,
  plotext,
  poetry-core,
  textual,
}:

buildPythonPackage rec {
  pname = "textual-plotext";
  version = "1.0.1";
  pyproject = true;

  # GitHub is missing tags: https://github.com/Textualize/textual-plotext/issues/18
  src = fetchPypi {
    pname = "textual_plotext";
    inherit version;
    hash = "sha256-g29TozFnVmCeGUEpo1wodWOOeVjCYfVB4KeU98mAEb4=";
  };

  build-system = [ poetry-core ];

  dependencies = [
    plotext
    textual
  ];

  pythonImportsCheck = [ "textual_plotext" ];

  meta = {
    description = "Textual widget wrapper for the Plotext plotting library";
    homepage = "https://github.com/Textualize/textual-plotext";
    changelog = "https://github.com/Textualize/textual-plotext/blob/main/ChangeLog.md";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ andersk ];
  };
}
+2 −0
Original line number Diff line number Diff line
@@ -18922,6 +18922,8 @@ self: super: with self; {
  textual-image = callPackage ../development/python-modules/textual-image { };
  textual-plotext = callPackage ../development/python-modules/textual-plotext { };
  textual-serve = callPackage ../development/python-modules/textual-serve { };
  textual-slider = callPackage ../development/python-modules/textual-slider { };