1{
2 lib,
3 stdenv,
4 buildPackages,
5 buildPythonPackage,
6 fetchFromGitHub,
7 installShellFiles,
8 ruamel-yaml,
9 xmltodict,
10 pygments,
11 pytestCheckHook,
12 pythonOlder,
13}:
14
15buildPythonPackage rec {
16 pname = "jc";
17 version = "1.25.5";
18 format = "setuptools";
19 disabled = pythonOlder "3.6";
20
21 src = fetchFromGitHub {
22 owner = "kellyjonbrazil";
23 repo = "jc";
24 tag = "v${version}";
25 hash = "sha256-tv466jVjLtmn2U8t3sSyQLuzGcVf0RHtE+cFd8j8T5k=";
26 };
27
28 propagatedBuildInputs = [
29 ruamel-yaml
30 xmltodict
31 pygments
32 ];
33
34 nativeBuildInputs = [ installShellFiles ];
35
36 postInstall =
37 let
38 emulator = stdenv.hostPlatform.emulator buildPackages;
39 in
40 ''
41 installShellCompletion --cmd jc \
42 --bash <(${emulator} $out/bin/jc --bash-comp) \
43 --zsh <(${emulator} $out/bin/jc --zsh-comp)
44 '';
45
46 nativeCheckInputs = [ pytestCheckHook ];
47
48 pythonImportsCheck = [ "jc" ];
49
50 # tests require timezone to set America/Los_Angeles
51 doCheck = false;
52
53 meta = with lib; {
54 description = "This tool serializes the output of popular command line tools and filetypes to structured JSON output";
55 homepage = "https://github.com/kellyjonbrazil/jc";
56 license = licenses.mit;
57 maintainers = with maintainers; [ atemu ];
58 changelog = "https://github.com/kellyjonbrazil/jc/blob/${src.tag}/CHANGELOG";
59 mainProgram = "jc";
60 };
61}