1{ stdenv, buildPythonPackage, fetchFromGitHub, python,
2 django, django_nose, six
3}:
4buildPythonPackage rec {
5 pname = "django-compat";
6 name = "${pname}-${version}";
7 version = "1.0.14";
8
9 # the pypi packages don't include everything required for the tests
10 src = fetchFromGitHub {
11 owner = "arteria";
12 repo = "django-compat";
13 rev = "v${version}";
14 sha256 = "11g6ra6djkchqk44v8k7biaxd1v69qyyyask5l92vmrvb0qiwvm8";
15 };
16
17 checkPhase = ''
18 runHook preCheck
19
20 # we have to do a little bit of tinkering to convince the tests to run against the installed package, not the
21 # source directory
22 mkdir -p testbase/compat
23 pushd testbase
24 # note we're not copying the direct contents of compat/ (notably __init__.py) so python won't recognize this as a
25 # package, but the tests need to be in a specific path for the test templates to get picked up.
26 cp -r ../compat/tests compat/
27 cp ../runtests.py .
28 ${python.interpreter} runtests.py compat/tests
29 popd
30
31 runHook postCheck
32 '';
33
34 checkInputs = [ django_nose ];
35 propagatedBuildInputs = [ django six ];
36
37 meta = with stdenv.lib; {
38 description = "Forward and backwards compatibility layer for Django 1.4, 1.7, 1.8, 1.9, 1.10 and 1.11";
39 homepage = https://github.com/arteria/django-compat;
40 license = licenses.mit;
41 maintainers = with maintainers; [ ris ];
42 };
43}