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 blinker,
18 docutils,
19 feedgenerator,
20 jinja2,
21 markdown,
22 ordered-set,
23 pygments,
24 python-dateutil,
25 rich,
26 tzdata,
27 unidecode,
28 watchfiles,
29
30 # tests
31 beautifulsoup4,
32 lxml,
33 mock,
34 pytestCheckHook,
35 pytest-xdist,
36}:
37
38buildPythonPackage rec {
39 pname = "pelican";
40 version = "4.11.0";
41 pyproject = true;
42
43 disabled = pythonOlder "3.8";
44
45 src = fetchFromGitHub {
46 owner = "getpelican";
47 repo = "pelican";
48 tag = version;
49 hash = "sha256-SrzHAqDX+DCeaWMmlG8tgA1RKLDnICkvDIE/kUQZN+s=";
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 build-system = [ pdm-backend ];
63
64 pythonRelaxDeps = [ "pygments" ];
65
66 buildInputs = [
67 glibcLocales
68 pandoc
69 git
70 markdown
71 typogrify
72 ];
73
74 dependencies = [
75 blinker
76 docutils
77 feedgenerator
78 jinja2
79 ordered-set
80 pygments
81 python-dateutil
82 rich
83 tzdata
84 unidecode
85 watchfiles
86 ];
87
88 optional-dependencies = {
89 markdown = [ markdown ];
90 };
91
92 nativeCheckInputs = [
93 beautifulsoup4
94 lxml
95 mock
96 pandoc
97 pytest-xdist
98 pytestCheckHook
99 ];
100
101 pytestFlags = [
102 # DeprecationWarning: 'jinja2.Markup' is deprecated and...
103 "-Wignore::DeprecationWarning"
104 ];
105
106 disabledTests = [
107 # AssertionError
108 "test_basic_generation_works"
109 "test_custom_generation_works"
110 "test_custom_locale_generation_works"
111 "test_deprecated_attribute"
112 # AttributeError
113 "test_wp_custpost_true_dirpage_false"
114 "test_can_toggle_raw_html_code_parsing"
115 "test_dirpage_directive_for_page_kind"
116 ];
117
118 env.LC_ALL = "en_US.UTF-8";
119
120 # We only want to patch shebangs in /bin, and not those
121 # of the project scripts that are created by Pelican.
122 # See https://github.com/NixOS/nixpkgs/issues/30116
123 dontPatchShebangs = true;
124
125 postFixup = ''
126 patchShebangs $out/bin
127 '';
128
129 pythonImportsCheck = [ "pelican" ];
130
131 meta = with lib; {
132 description = "Static site generator that requires no database or server-side logic";
133 homepage = "https://getpelican.com/";
134 changelog = "https://github.com/getpelican/pelican/blob/${src.tag}/docs/changelog.rst";
135 license = licenses.agpl3Only;
136 maintainers = with maintainers; [
137 offline
138 prikhi
139 ];
140 };
141}