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