2021-01-25 08:26:54 +00:00
|
|
|
{ lib
|
2018-10-16 18:52:45 +01:00
|
|
|
, buildPythonPackage
|
2019-06-02 19:30:31 +01:00
|
|
|
, python
|
2021-01-30 22:18:48 +00:00
|
|
|
, pythonAtLeast
|
2019-06-02 19:30:31 +01:00
|
|
|
, fetchFromGitHub
|
2021-01-30 22:18:48 +00:00
|
|
|
, fetchpatch
|
2018-10-16 18:52:45 +01:00
|
|
|
, django
|
|
|
|
, pygments
|
|
|
|
, simplejson
|
|
|
|
, dateutil
|
|
|
|
, requests
|
|
|
|
, sqlparse
|
|
|
|
, jinja2
|
|
|
|
, autopep8
|
|
|
|
, pytz
|
|
|
|
, pillow
|
|
|
|
, mock
|
2019-06-02 19:29:46 +01:00
|
|
|
, gprof2dot
|
2019-06-02 19:30:31 +01:00
|
|
|
, freezegun
|
|
|
|
, contextlib2
|
|
|
|
, networkx
|
|
|
|
, pydot
|
|
|
|
, factory_boy
|
2018-10-16 18:52:45 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "django-silk";
|
2021-01-30 22:18:48 +00:00
|
|
|
version = "4.1.0";
|
2018-10-16 18:52:45 +01:00
|
|
|
|
2019-06-02 19:30:31 +01:00
|
|
|
# pypi tarball doesn't include test project
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "jazzband";
|
|
|
|
repo = "django-silk";
|
|
|
|
rev = version;
|
2021-01-30 22:18:48 +00:00
|
|
|
sha256 = "1km3hmx1sir0c5gqr2p1h2938slhxp2hzf10cb80q98mas8spjkn";
|
2018-10-16 18:52:45 +01:00
|
|
|
};
|
2021-01-30 22:18:48 +00:00
|
|
|
|
|
|
|
patches = lib.optional (pythonAtLeast "3.9") (fetchpatch {
|
|
|
|
# should be able to remove after 4.1.1
|
|
|
|
name = "python-3.9-support.patch";
|
|
|
|
url = "https://github.com/jazzband/django-silk/commit/134089e4cad7bd3b76fb0f70c423082cb7d2b34a.patch";
|
|
|
|
sha256 = "09c1xd9y33h3ibiv5w9af9d79c909rgc1g5sxpd4y232h5id3c8r";
|
|
|
|
});
|
|
|
|
|
2019-06-02 19:30:31 +01:00
|
|
|
# "test_time_taken" tests aren't suitable for reproducible execution, but django's
|
|
|
|
# test runner doesn't have an easy way to ignore tests - so instead prevent it from picking
|
|
|
|
# them up as tests
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace project/tests/test_silky_profiler.py \
|
|
|
|
--replace "def test_time_taken" "def _test_time_taken"
|
2020-07-28 19:48:19 +01:00
|
|
|
substituteInPlace setup.py \
|
|
|
|
--replace 'use_scm_version=True' 'version="${version}"'
|
2019-06-02 19:30:31 +01:00
|
|
|
'';
|
2018-10-16 18:52:45 +01:00
|
|
|
|
|
|
|
buildInputs = [ mock ];
|
2019-06-02 19:29:46 +01:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
django pygments simplejson dateutil requests
|
|
|
|
sqlparse jinja2 autopep8 pytz pillow gprof2dot
|
|
|
|
];
|
|
|
|
|
2019-06-02 19:30:31 +01:00
|
|
|
checkInputs = [ freezegun contextlib2 networkx pydot factory_boy ];
|
|
|
|
checkPhase = ''
|
|
|
|
cd project
|
|
|
|
DB=sqlite3 DB_NAME=db.sqlite3 ${python.interpreter} manage.py test
|
|
|
|
'';
|
2018-10-16 18:52:45 +01:00
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2018-10-16 18:52:45 +01:00
|
|
|
description = "Silky smooth profiling for the Django Framework";
|
2020-07-28 19:48:19 +01:00
|
|
|
homepage = "https://github.com/jazzband/django-silk";
|
2018-10-16 18:52:45 +01:00
|
|
|
license = licenses.mit;
|
2019-06-02 19:31:02 +01:00
|
|
|
maintainers = with maintainers; [ ris ];
|
2018-10-16 18:52:45 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|