diff options
Diffstat (limited to 'nixpkgs/pkgs/development/tools/ruff/default.nix')
-rw-r--r-- | nixpkgs/pkgs/development/tools/ruff/default.nix | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/nixpkgs/pkgs/development/tools/ruff/default.nix b/nixpkgs/pkgs/development/tools/ruff/default.nix index dadfba7cc67b..999c8e54baaf 100644 --- a/nixpkgs/pkgs/development/tools/ruff/default.nix +++ b/nixpkgs/pkgs/development/tools/ruff/default.nix @@ -1,26 +1,43 @@ { lib , rustPlatform , fetchFromGitHub +, fetchpatch , installShellFiles , stdenv , darwin , rust-jemalloc-sys - # tests , ruff-lsp }: rustPlatform.buildRustPackage rec { pname = "ruff"; - version = "0.1.13"; + version = "0.2.1"; src = fetchFromGitHub { owner = "astral-sh"; repo = "ruff"; rev = "refs/tags/v${version}"; - hash = "sha256-cH/Vw04QQ3U7E1ZCwozjhPcn0KVljP976/p3okrBpEU="; + hash = "sha256-VcDDGi6fPGZ75+J7aOSr7S6Gt5bpr0vM2Sk/Utlmf4k="; }; - cargoHash = "sha256-tmoFnghHQEsyv0vO9fnWyTsxiIhmovhi/zHXOCi5u10="; + patches = [ + # TODO: remove at next release + (fetchpatch { + name = "filter-out-test-rules-in-ruleselector-json-schema"; + url = "https://github.com/astral-sh/ruff/commit/49c5e715f9c85aa8d0412b2ec9b1dd6f7ae24c5c.patch"; + hash = "sha256-s0Nv5uW3TKfKgro3V3E8Q0c8uOTgOKZQx9CxXge4YWE="; + }) + ]; + + # The following specific substitution is not working as the current directory is `/build/source` and thus has no mention of `ruff` in it. + # https://github.com/astral-sh/ruff/blob/866bea60a5de3c59d2537b0f3a634ae0ac9afd94/crates/ruff/tests/show_settings.rs#L12 + # -> Just patch it so that it expects the actual current directory and not `"[BASEPATH]"`. + postPatch = '' + substituteInPlace crates/ruff/tests/snapshots/show_settings__display_default_settings.snap \ + --replace '"[BASEPATH]"' '"'$PWD'"' + ''; + + cargoHash = "sha256-B7AiDNWEN4i/Lz9yczlRNXczQph52SMa3pcxK2AtO2A="; nativeBuildInputs = [ installShellFiles @@ -32,9 +49,6 @@ rustPlatform.buildRustPackage rec { darwin.apple_sdk.frameworks.CoreServices ]; - cargoBuildFlags = [ "--package=ruff_cli" ]; - cargoTestFlags = cargoBuildFlags; - # tests expect no colors preCheck = '' export NO_COLOR=1 |