Merge pull request #62544 from risicle/ris-django-silk-fix

pythonPackages.django_silk: fix build, enable tests
This commit is contained in:
Mario Rodas 2019-06-09 09:02:56 -05:00 committed by GitHub
commit 6e448db9d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 39 additions and 10 deletions

View file

@ -1,6 +1,7 @@
{ stdenv
, buildPythonPackage
, fetchPypi
, python
, fetchFromGitHub
, django
, pygments
, simplejson
@ -12,26 +13,50 @@
, pytz
, pillow
, mock
, gprof2dot
, freezegun
, contextlib2
, networkx
, pydot
, factory_boy
}:
buildPythonPackage rec {
pname = "django-silk";
version = "3.0.2";
src = fetchPypi {
inherit pname version;
sha256 = "8dd5b78531360bd8c3d571384f9f4f82ef03e1764e30dd4621c5638f5c973a1d";
# pypi tarball doesn't include test project
src = fetchFromGitHub {
owner = "jazzband";
repo = "django-silk";
rev = version;
sha256 = "1fbaafc2gx01gscdalp6hj6bz4b0cmq59lgmvsydw7jkds4mps7c";
};
doCheck = false;
# "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"
'';
buildInputs = [ mock ];
propagatedBuildInputs = [ django pygments simplejson dateutil requests sqlparse jinja2 autopep8 pytz pillow ];
propagatedBuildInputs = [
django pygments simplejson dateutil requests
sqlparse jinja2 autopep8 pytz pillow gprof2dot
];
checkInputs = [ freezegun contextlib2 networkx pydot factory_boy ];
checkPhase = ''
cd project
DB=sqlite3 DB_NAME=db.sqlite3 ${python.interpreter} manage.py test
'';
meta = with stdenv.lib; {
description = "Silky smooth profiling for the Django Framework";
homepage = https://github.com/mtford90/silk;
license = licenses.mit;
maintainers = with maintainers; [ ris ];
};
}

View file

@ -1,4 +1,4 @@
{ lib, fetchFromGitHub, buildPythonApplication }:
{ lib, fetchFromGitHub, buildPythonApplication, python, graphviz }:
buildPythonApplication {
name = "gprof2dot-2017-09-19";
@ -10,11 +10,13 @@ buildPythonApplication {
sha256 = "1b5wvjv5ykbhz7aix7l3y7mg1hxi0vgak4a49gr92sdlz8blj51v";
};
checkInputs = [ graphviz ];
checkPhase = "${python.interpreter} tests/test.py";
meta = with lib; {
homepage = https://github.com/jrfonseca/gprof2dot;
description = "Python script to convert the output from many profilers into a dot graph";
license = licenses.lgpl3Plus;
platforms = platforms.linux;
maintainers = [ maintainers.pmiddend ];
};
}

View file

@ -454,7 +454,9 @@ in {
grandalf = callPackage ../development/python-modules/grandalf { };
gprof2dot = callPackage ../development/python-modules/gprof2dot { };
gprof2dot = callPackage ../development/python-modules/gprof2dot {
inherit (pkgs) graphviz;
};
gsd = callPackage ../development/python-modules/gsd { };