base16-schemes: unstable-2024-06-21 -> unstable-2024-11-12
[NixPkgs.git] / pkgs / by-name / py / pylyzer / package.nix
bloba73a9de8f7285fc567d5f7d994737da0bd98566e
2   lib,
3   stdenv,
4   rustPlatform,
5   fetchFromGitHub,
6   git,
7   python3,
8   makeWrapper,
9   writeScriptBin,
10   which,
11   nix-update-script,
12   versionCheckHook,
15 rustPlatform.buildRustPackage rec {
16   pname = "pylyzer";
17   version = "0.0.70";
19   src = fetchFromGitHub {
20     owner = "mtshiba";
21     repo = "pylyzer";
22     rev = "refs/tags/v${version}";
23     hash = "sha256-jj9r5npClLY9mhDHFI92825RYvwn6m9KlngfFL0bqCw=";
24   };
26   cargoLock = {
27     lockFile = ./Cargo.lock;
28     outputHashes = {
29       "rustpython-ast-0.4.0" = "sha256-RChZlXzdzyLp0Lb/LTLbWfbUzPDhmWkf0uVobflCKRk=";
30     };
31   };
33   nativeBuildInputs = [
34     git
35     python3
36     makeWrapper
37   ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ (writeScriptBin "diskutil" "") ];
39   buildInputs = [
40     python3
41   ];
43   preBuild = ''
44     export HOME=$(mktemp -d)
45   '';
47   postInstall = ''
48     mkdir -p $out/lib
49     cp -r $HOME/.erg/ $out/lib/erg
50   '';
52   nativeCheckInputs = [ which ];
54   checkFlags =
55     [
56       # this test causes stack overflow
57       # > thread 'exec_import' has overflowed its stack
58       "--skip=exec_import"
59     ]
60     ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) [
61       # Dict({Str..Obj: Int}) does not implement Iterable(Str..Obj..Obj) and Indexable({"a"}..Obj, Int)
62       # https://github.com/mtshiba/pylyzer/issues/114
63       "--skip=exec_casting"
64     ];
66   postFixup = ''
67     wrapProgram $out/bin/pylyzer --set ERG_PATH $out/lib/erg
68   '';
70   nativeInstallCheckInputs = [
71     versionCheckHook
72   ];
73   versionCheckProgramArg = [ "--version" ];
74   doInstallCheck = true;
76   passthru = {
77     updateScript = nix-update-script { };
78   };
80   meta = {
81     description = "Fast static code analyzer & language server for Python";
82     homepage = "https://github.com/mtshiba/pylyzer";
83     changelog = "https://github.com/mtshiba/pylyzer/releases/tag/v${version}";
84     license = lib.licenses.mit;
85     maintainers = with lib.maintainers; [ natsukium ];
86     mainProgram = "pylyzer";
87   };