1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonOlder,
6 pythonRelaxDepsHook,
7
8 # build-system
9 pdm-backend,
10
11 # native dependencies
12 glibcLocales,
13 git,
14 pandoc,
15 typogrify,
16
17 # dependencies
18 backports-zoneinfo,
19 blinker,
20 docutils,
21 feedgenerator,
22 jinja2,
23 markdown,
24 ordered-set,
25 pygments,
26 python-dateutil,
27 rich,
28 tzdata,
29 unidecode,
30 watchfiles,
31
32 # tests
33 mock,
34 pytestCheckHook,
35 pytest-xdist,
36}:
37
38buildPythonPackage rec {
39 pname = "pelican";
40 version = "4.9.1";
41 pyproject = true;
42
43 disabled = pythonOlder "3.8";
44
45 src = fetchFromGitHub {
46 owner = "getpelican";
47 repo = "pelican";
48 rev = "refs/tags/${version}";
49 hash = "sha256-nz2OnxJ4mGgnafz4Xp8K/BTyVgXNpNYqteNL1owP8Hk=";
50 # Remove unicode file names which leads to different checksums on HFS+
51 # vs. other filesystems because of unicode normalisation.
52 postFetch = ''
53 rm -r $out/pelican/tests/output/custom_locale/posts
54 '';
55 };
56
57 postPatch = ''
58 substituteInPlace pelican/tests/test_pelican.py \
59 --replace "'git'" "'${git}/bin/git'"
60 '';
61
62 nativeBuildInputs = [
63 pdm-backend
64 pythonRelaxDepsHook
65 ];
66
67 pythonRelaxDeps = [ "unidecode" ];
68
69 buildInputs = [
70 glibcLocales
71 pandoc
72 git
73 markdown
74 typogrify
75 ];
76
77 propagatedBuildInputs = [
78 blinker
79 docutils
80 feedgenerator
81 jinja2
82 ordered-set
83 pygments
84 python-dateutil
85 rich
86 tzdata
87 unidecode
88 watchfiles
89 ] ++ lib.optionals (pythonOlder "3.9") [ backports-zoneinfo ];
90
91 nativeCheckInputs = [
92 mock
93 pytest-xdist
94 pytestCheckHook
95 pandoc
96 ];
97
98 pytestFlagsArray = [
99 # DeprecationWarning: 'jinja2.Markup' is deprecated and...
100 "-W ignore::DeprecationWarning"
101 ];
102
103 disabledTests = [
104 # AssertionError
105 "test_basic_generation_works"
106 "test_custom_generation_works"
107 "test_custom_locale_generation_works"
108 ];
109
110 env.LC_ALL = "en_US.UTF-8";
111
112 # We only want to patch shebangs in /bin, and not those
113 # of the project scripts that are created by Pelican.
114 # See https://github.com/NixOS/nixpkgs/issues/30116
115 dontPatchShebangs = true;
116
117 postFixup = ''
118 patchShebangs $out/bin
119 '';
120
121 pythonImportsCheck = [ "pelican" ];
122
123 meta = with lib; {
124 description = "Static site generator that requires no database or server-side logic";
125 homepage = "https://getpelican.com/";
126 license = licenses.agpl3Only;
127 maintainers = with maintainers; [
128 offline
129 prikhi
130 ];
131 };
132}