depot/third_party/nixpkgs/pkgs/development/python-modules/jc/default.nix
Default email bcb2f287e1 Project import generated by Copybara.
GitOrigin-RevId: d603719ec6e294f034936c0d0dc06f689d91b6c3
2024-06-20 20:27:18 +05:30

61 lines
1.4 KiB
Nix

{
lib,
stdenv,
buildPackages,
buildPythonPackage,
fetchFromGitHub,
installShellFiles,
ruamel-yaml,
xmltodict,
pygments,
pytestCheckHook,
pythonOlder,
}:
buildPythonPackage rec {
pname = "jc";
version = "1.25.3";
format = "setuptools";
disabled = pythonOlder "3.6";
src = fetchFromGitHub {
owner = "kellyjonbrazil";
repo = pname;
rev = "refs/tags/v${version}";
hash = "sha256-yp5533CzqJ++G6nHip1281ZkB4JyfLb3inR9BwDkxSs=";
};
propagatedBuildInputs = [
ruamel-yaml
xmltodict
pygments
];
nativeBuildInputs = [ installShellFiles ];
postInstall =
let
emulator = stdenv.hostPlatform.emulator buildPackages;
in
''
installShellCompletion --cmd jc \
--bash <(${emulator} $out/bin/jc --bash-comp) \
--zsh <(${emulator} $out/bin/jc --zsh-comp)
'';
nativeCheckInputs = [ pytestCheckHook ];
pythonImportsCheck = [ "jc" ];
# tests require timezone to set America/Los_Angeles
doCheck = false;
meta = with lib; {
description = "This tool serializes the output of popular command line tools and filetypes to structured JSON output";
homepage = "https://github.com/kellyjonbrazil/jc";
license = licenses.mit;
maintainers = with maintainers; [ atemu ];
changelog = "https://github.com/kellyjonbrazil/jc/blob/v${version}/CHANGELOG";
mainProgram = "jc";
};
}