1{
2 lib,
3 buildPythonPackage,
4 cssutils,
5 cython,
6 fetchPypi,
7 pytestCheckHook,
8 pythonOlder,
9}:
10
11buildPythonPackage rec {
12 pname = "tinycss";
13 version = "0.4";
14 format = "setuptools";
15
16 disabled = pythonOlder "3.7";
17
18 src = fetchPypi {
19 inherit pname version;
20 hash = "sha256-EjBvtQ5enn6u74S4Au2HdIi6gONcZyhn9UjAkkp2cW4=";
21 };
22
23 postPatch = ''
24 sed -i "/--cov/d" setup.cfg
25 '';
26
27 nativeBuildInputs = [ cython ];
28
29 propagatedBuildInputs = [ cssutils ];
30
31 nativeCheckInputs = [ pytestCheckHook ];
32
33 preBuild = ''
34 # Force Cython to re-generate this file. If it is present, Cython will
35 # think it is "up to date" even though it was generated with an older,
36 # incompatible version of Cython. See
37 # https://github.com/Kozea/tinycss/issues/17.
38 rm tinycss/speedups.c
39 '';
40
41 # Disable Cython tests
42 TINYCSS_SKIP_SPEEDUPS_TESTS = true;
43
44 pythonImportsCheck = [ "tinycss" ];
45
46 meta = with lib; {
47 description = "Complete yet simple CSS parser for Python";
48 homepage = "https://tinycss.readthedocs.io";
49 changelog = "https://github.com/Kozea/tinycss/releases/tag/v${version}";
50 license = licenses.bsd3;
51 maintainers = [ ];
52 };
53}