1{ pkgs
2, buildPythonPackage
3, fetchPypi
4, pytest
5, python
6, cython
7, cssutils
8, isPyPy
9}:
10
11buildPythonPackage rec {
12 pname = "tinycss";
13 version = "0.4";
14
15 src = fetchPypi {
16 inherit pname version;
17 sha256 = "12306fb50e5e9e7eaeef84b802ed877488ba80e35c672867f548c0924a76716e";
18 };
19
20 checkInputs = [ pytest ];
21 propagatedBuildInputs = [ cssutils ];
22 nativeBuildInputs = [
23 cython
24 ];
25
26 preBuild = ''
27 # Force cython to re-generate this file. If it is present, cython will
28 # think it is "up to date" even though it was generated with an older,
29 # incompatible version of cython. See
30 # https://github.com/Kozea/tinycss/issues/17.
31 rm tinycss/speedups.c
32 '';
33
34 checkPhase = ''
35 py.test $out/${python.sitePackages}
36 '';
37
38 # Disable Cython tests for PyPy
39 TINYCSS_SKIP_SPEEDUPS_TESTS = pkgs.lib.optional isPyPy true;
40
41 meta = with pkgs.lib; {
42 description = "Complete yet simple CSS parser for Python";
43 license = licenses.bsd3;
44 homepage = "https://pythonhosted.org/tinycss/";
45 maintainers = [ maintainers.costrouc ];
46 };
47}