about summary refs log tree commit diff
path: root/nixpkgs/pkgs/by-name/py/pyp/package.nix
blob: 08f3fdc63d4915abaee0348d59c3893c90fe0480 (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
, bc
, fetchFromGitHub
, jq
, python3
}:

let
  pythonPackages = python3.pkgs;
  finalAttrs = {
    pname = "pyp";
    version = "1.2.0";

    src = fetchFromGitHub {
      owner = "hauntsaninja";
      repo = "pyp";
      rev = "refs/tags/v${finalAttrs.version}";
      hash = "sha256-hnEgqWOIVj2ugOhd2aS9IulfkVnrlkhwOtrgH4qQqO8=";
    };

    pyproject = true;

    build-system = with pythonPackages; [
      flit-core
    ];

    nativeCheckInputs = (with pythonPackages; [
      pytestCheckHook
    ]) ++ [
      bc
      jq
    ];

    pythonImportsCheck = [
      "pyp"
    ];

    # without this, the tests fail because they are unable to find the pyp tool
    # itself...
    preCheck = ''
      _OLD_PATH_=$PATH
      PATH=$out/bin:$PATH
   '';

    # And a cleanup!
    postCheck = ''
      PATH=$_OLD_PATH_
    '';

    meta = {
      homepage = "https://github.com/hauntsaninja/pyp";
      description = "Easily run Python at the shell";
      changelog = "https://github.com/hauntsaninja/pyp/blob/${finalAttrs.version}/CHANGELOG.md";
      license = with lib.licenses; [ mit ];
      mainProgram = "pyp";
      maintainers = with lib.maintainers; [ rmcgibbo AndersonTorres ];
    };
  };
in
pythonPackages.buildPythonPackage finalAttrs