summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/pelican/default.nix
blob: aff3ee77063221963502b2320497a38f2c80e387 (plain)
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,

  # build-system
  pdm-backend,

  # native dependencies
  glibcLocales,
  git,
  pandoc,
  typogrify,

  # dependencies
  blinker,
  docutils,
  feedgenerator,
  jinja2,
  markdown,
  ordered-set,
  pygments,
  python-dateutil,
  rich,
  tzdata,
  unidecode,
  watchfiles,

  # tests
  beautifulsoup4,
  lxml,
  mock,
  pytestCheckHook,
  pytest-xdist,
}:

buildPythonPackage rec {
  pname = "pelican";
  version = "4.11.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "getpelican";
    repo = "pelican";
    tag = version;
    hash = "sha256-SrzHAqDX+DCeaWMmlG8tgA1RKLDnICkvDIE/kUQZN+s=";
    # 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
    '';
  };

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

  build-system = [ pdm-backend ];

  pythonRelaxDeps = [ "pygments" ];

  buildInputs = [
    glibcLocales
    pandoc
    git
    markdown
    typogrify
  ];

  dependencies = [
    blinker
    docutils
    feedgenerator
    jinja2
    ordered-set
    pygments
    python-dateutil
    rich
    tzdata
    unidecode
    watchfiles
  ];

  optional-dependencies = {
    markdown = [ markdown ];
  };

  nativeCheckInputs = [
    beautifulsoup4
    lxml
    mock
    pandoc
    pytest-xdist
    pytestCheckHook
  ];

  pytestFlags = [
    # DeprecationWarning: 'jinja2.Markup' is deprecated and...
    "-Wignore::DeprecationWarning"
  ];

  disabledTests = [
    # AssertionError
    "test_basic_generation_works"
    "test_custom_generation_works"
    "test_custom_locale_generation_works"
    "test_deprecated_attribute"
    # AttributeError
    "test_wp_custpost_true_dirpage_false"
    "test_can_toggle_raw_html_code_parsing"
    "test_dirpage_directive_for_page_kind"
  ];

  env.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 = {
    description = "Static site generator that requires no database or server-side logic";
    homepage = "https://getpelican.com/";
    changelog = "https://github.com/getpelican/pelican/blob/${src.tag}/docs/changelog.rst";
    license = lib.licenses.agpl3Only;
    maintainers = with lib.maintainers; [
      offline
      prikhi
    ];
  };
}