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