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