summary refs log tree commit diff
path: root/pkgs/development/python-modules/pelican/default.nix
blob: 9f11251ea8a811abe9247c9cc224566fd0693fbf (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
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
{ lib
, beautifulsoup4
, blinker
, buildPythonPackage
, docutils
, feedgenerator
, fetchFromGitHub
, git
, glibcLocales
, jinja2
, lxml
, markdown
, markupsafe
, mock
, pytestCheckHook
, pandoc
, pillow
, pygments
, python-dateutil
, pythonOlder
, pytz
, rich
, pytest-xdist
, six
, typogrify
, unidecode
}:

buildPythonPackage rec {
  pname = "pelican";
  version = "4.7.2";
  disabled = pythonOlder "3.6";

  src = fetchFromGitHub {
    owner = "getpelican";
    repo = pname;
    rev = version;
    hash = "sha256-ZBGzsyCtFt5uj9mpOpGdTzGJET0iwOAgDTy80P6anRU=";
    # Remove unicode file names which leads to different checksums on HFS+
    # vs. other filesystems because of unicode normalisation.
    postFetch = ''
      rm -r $out/pelican/tests/output/custom_locale/posts
    '';
  };

  buildInputs = [
    glibcLocales
    pandoc
    git
    mock
    markdown
    typogrify
  ];

  propagatedBuildInputs = [
    beautifulsoup4
    blinker
    docutils
    feedgenerator
    jinja2
    lxml
    markupsafe
    pillow
    pygments
    python-dateutil
    pytz
    rich
    six
    unidecode
  ];

  checkInputs = [
    pytest-xdist
    pytestCheckHook
    pandoc
  ];

  postPatch = ''
    substituteInPlace pelican/tests/test_pelican.py \
      --replace "'git'" "'${git}/bin/git'"
  '';

  pytestFlagsArray = [
    # DeprecationWarning: 'jinja2.Markup' is deprecated and...
    "-W ignore::DeprecationWarning"
  ];

  disabledTests = [
    # AssertionError
    "test_basic_generation_works"
    "test_custom_generation_works"
    "test_custom_locale_generation_works"
  ];

  LC_ALL = "en_US.UTF-8";

  # We only want to patch shebangs in /bin, and not those
  # of the project scripts that are created by Pelican.
  # See https://github.com/NixOS/nixpkgs/issues/30116
  dontPatchShebangs = true;

  postFixup = ''
    patchShebangs $out/bin
  '';

  pythonImportsCheck = [ "pelican" ];

  meta = with lib; {
    description = "Static site generator that requires no database or server-side logic";
    homepage = "http://getpelican.com/";
    license = licenses.agpl3;
    maintainers = with maintainers; [ offline prikhi ];
  };
}