about summary refs log tree commit diff
path: root/pkgs/development/python-modules/tinycss/default.nix
blob: f525e40d16b9652067d23efb59e25326bce1187b (plain) (blame)
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
{
  lib,
  buildPythonPackage,
  cssutils,
  cython,
  fetchPypi,
  pytestCheckHook,
  pythonOlder,
}:

buildPythonPackage rec {
  pname = "tinycss";
  version = "0.4";
  format = "setuptools";

  disabled = pythonOlder "3.7";

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-EjBvtQ5enn6u74S4Au2HdIi6gONcZyhn9UjAkkp2cW4=";
  };

  postPatch = ''
    sed -i "/--cov/d" setup.cfg
  '';

  nativeBuildInputs = [ cython ];

  propagatedBuildInputs = [ cssutils ];

  nativeCheckInputs = [ pytestCheckHook ];

  preBuild = ''
    # Force Cython to re-generate this file. If it is present, Cython will
    # think it is "up to date" even though it was generated with an older,
    # incompatible version of Cython. See
    # https://github.com/Kozea/tinycss/issues/17.
    rm tinycss/speedups.c
  '';

  # Disable Cython tests
  TINYCSS_SKIP_SPEEDUPS_TESTS = true;

  pythonImportsCheck = [ "tinycss" ];

  meta = with lib; {
    description = "Complete yet simple CSS parser for Python";
    homepage = "https://tinycss.readthedocs.io";
    changelog = "https://github.com/Kozea/tinycss/releases/tag/v${version}";
    license = licenses.bsd3;
    maintainers = [ ];
  };
}