about summary refs log tree commit diff
path: root/pkgs/development/python-modules/beautysh/default.nix
blob: 79cda3b5eec6f25a6160110541a9d56547f303aa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
{
  lib,
  buildPythonPackage,
  colorama,
  fetchFromGitHub,
  fetchpatch,
  poetry-core,
  pytestCheckHook,
  setuptools,
  types-colorama,
  types-setuptools,
}:

buildPythonPackage rec {
  pname = "beautysh";
  version = "6.2.1";
  format = "pyproject";

  src = fetchFromGitHub {
    owner = "lovesegfault";
    repo = pname;
    rev = "v${version}";
    hash = "sha256-rPeGRcyNK45Y7OvtzaIH93IIzexBf/jM1SzYP0phQ1o=";
  };

  patches = [
    # https://github.com/lovesegfault/beautysh/pull/247
    (fetchpatch {
      name = "poetry-to-poetry-core.patch";
      url = "https://github.com/lovesegfault/beautysh/commit/5f4fcac083fa68568a50f3c2bcee3ead0f3ca7c5.patch";
      hash = "sha256-H/kIJKww5ouWu8rmRkaMOXcsq2daZWDdwxBqbc99x0s=";
    })
  ];

  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace 'types-setuptools = "^57.4.0"' 'types-setuptools = "*"'
  '';

  nativeBuildInputs = [ poetry-core ];

  propagatedBuildInputs = [
    colorama
    setuptools
    types-colorama
    types-setuptools
  ];

  nativeCheckInputs = [ pytestCheckHook ];

  pythonImportsCheck = [ "beautysh" ];

  meta = with lib; {
    description = "Tool for beautifying Bash scripts";
    homepage = "https://github.com/lovesegfault/beautysh";
    license = with licenses; [ asl20 ];
    maintainers = with maintainers; [ fab ];
    mainProgram = "beautysh";
  };
}