1{
2 lib,
3 buildPythonPackage,
4 colorama,
5 fetchFromGitHub,
6 fetchpatch,
7 poetry-core,
8 pytest7CheckHook,
9 setuptools,
10 types-colorama,
11 types-setuptools,
12}:
13
14buildPythonPackage rec {
15 pname = "beautysh";
16 version = "6.2.1";
17 format = "pyproject";
18
19 src = fetchFromGitHub {
20 owner = "lovesegfault";
21 repo = "beautysh";
22 rev = "v${version}";
23 hash = "sha256-rPeGRcyNK45Y7OvtzaIH93IIzexBf/jM1SzYP0phQ1o=";
24 };
25
26 patches = [
27 # https://github.com/lovesegfault/beautysh/pull/247
28 (fetchpatch {
29 name = "poetry-to-poetry-core.patch";
30 url = "https://github.com/lovesegfault/beautysh/commit/5f4fcac083fa68568a50f3c2bcee3ead0f3ca7c5.patch";
31 hash = "sha256-H/kIJKww5ouWu8rmRkaMOXcsq2daZWDdwxBqbc99x0s=";
32 })
33 ];
34
35 postPatch = ''
36 substituteInPlace pyproject.toml \
37 --replace 'types-setuptools = "^57.4.0"' 'types-setuptools = "*"'
38 '';
39
40 nativeBuildInputs = [ poetry-core ];
41
42 propagatedBuildInputs = [
43 colorama
44 setuptools
45 types-colorama
46 types-setuptools
47 ];
48
49 nativeCheckInputs = [ pytest7CheckHook ];
50
51 pythonImportsCheck = [ "beautysh" ];
52
53 meta = with lib; {
54 description = "Tool for beautifying Bash scripts";
55 homepage = "https://github.com/lovesegfault/beautysh";
56 license = with licenses; [ asl20 ];
57 maintainers = with maintainers; [ fab ];
58 mainProgram = "beautysh";
59 };
60}