summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/cookiecutter/default.nix
blob: c89be0107a43bda4fdc1077e44b9a7ece1604bea (plain)
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
{
  lib,
  buildPythonPackage,
  fetchPypi,
  isPyPy,
  bash,
  setuptools,
  pytestCheckHook,
  pytest-cov-stub,
  pytest-mock,
  freezegun,
  git,
  jinja2,
  binaryornot,
  click,
  jinja2-time,
  requests,
  python-slugify,
  pyyaml,
  arrow,
  rich,
}:

buildPythonPackage rec {
  pname = "cookiecutter";
  version = "2.6.0";
  pyproject = true;

  # not sure why this is broken
  disabled = isPyPy;

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-2yH4Fp6k9P3CQI1IykSFk0neJkf75JSp1sPt/AVCwhw=";
  };

  postPatch = ''
    patchShebangs tests/test-pyshellhooks/hooks tests/test-shellhooks/hooks

    substituteInPlace tests/test_hooks.py \
      --replace-fail "/bin/bash" "${lib.getExe bash}"
  '';

  build-system = [ setuptools ];

  nativeCheckInputs = [
    pytestCheckHook
    pytest-cov-stub
    pytest-mock
    freezegun
    git
  ];

  dependencies = [
    binaryornot
    jinja2
    click
    pyyaml
    jinja2-time
    python-slugify
    requests
    arrow
    rich
  ];

  pythonImportsCheck = [ "cookiecutter.main" ];

  preCheck = ''
    export HOME="$(mktemp -d)"
  '';

  disabledTests = [
    # messes with $PYTHONPATH
    "test_should_invoke_main"
  ];

  meta = {
    homepage = "https://github.com/audreyr/cookiecutter";
    changelog = "https://github.com/cookiecutter/cookiecutter/blob/${version}/HISTORY.md";
    description = "Command-line utility that creates projects from project templates";
    mainProgram = "cookiecutter";
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [ kragniz ];
  };
}