shrinkray: 25.9.1-unstable-2025-09-11 → 26.2.4.1

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
Anders Kaseorg
2026-02-06 15:45:50 -08:00
parent 9a5b491bc0
commit fb245b31ec
2 changed files with 47 additions and 46 deletions
+47 -12
View File
@@ -1,47 +1,82 @@
{
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 = {
@@ -1,34 +0,0 @@
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(