1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 python, 6 cairocffi, 7 django, 8 django-tagging, 9 fetchFromGitHub, 10 fetchpatch, 11 gunicorn, 12 mock, 13 pyparsing, 14 python-memcached, 15 pythonOlder, 16 pytz, 17 six, 18 txamqp, 19 urllib3, 20 whisper, 21}: 22 23buildPythonPackage rec { 24 pname = "graphite-web"; 25 version = "1.1.10"; 26 format = "setuptools"; 27 28 disabled = pythonOlder "3.7"; 29 30 src = fetchFromGitHub { 31 owner = "graphite-project"; 32 repo = pname; 33 rev = version; 34 hash = "sha256-2HgCBKwLfxJLKMopoIdsEW5k/j3kNAiifWDnJ98a7Qo="; 35 }; 36 37 patches = [ 38 (fetchpatch { 39 name = "CVE-2022-4730.CVE-2022-4729.CVE-2022-4728.part-1.patch"; 40 url = "https://github.com/graphite-project/graphite-web/commit/9c626006eea36a9fd785e8f811359aebc9774970.patch"; 41 hash = "sha256-JMmdhLqsaRhUG2FsH+yPNl+cR7O2YLfKFliL2GU0aAk="; 42 }) 43 (fetchpatch { 44 name = "CVE-2022-4730.CVE-2022-4729.CVE-2022-4728.part-2.patch"; 45 url = "https://github.com/graphite-project/graphite-web/commit/2f178f490e10efc03cd1d27c72f64ecab224eb23.patch"; 46 hash = "sha256-NL7K5uekf3NlLa58aFFRPJT9ktjqBeNlWC4Htd0fRQ0="; 47 }) 48 ]; 49 50 propagatedBuildInputs = [ 51 cairocffi 52 django 53 django-tagging 54 gunicorn 55 pyparsing 56 python-memcached 57 pytz 58 six 59 txamqp 60 urllib3 61 whisper 62 ]; 63 64 postPatch = '' 65 substituteInPlace setup.py \ 66 --replace "Django>=1.8,<3.1" "Django" \ 67 --replace "django-tagging==0.4.3" "django-tagging" 68 ''; 69 70 # Carbon-s default installation is /opt/graphite. This env variable ensures 71 # carbon is installed as a regular Python module. 72 GRAPHITE_NO_PREFIX = "True"; 73 74 preConfigure = '' 75 substituteInPlace webapp/graphite/settings.py \ 76 --replace "join(WEBAPP_DIR, 'content')" "join('$out', 'webapp', 'content')" 77 ''; 78 79 checkInputs = [ mock ]; 80 checkPhase = '' 81 runHook preCheck 82 83 pushd webapp/ 84 # avoid confusion with installed module 85 rm -r graphite 86 # redis not practical in test environment 87 substituteInPlace tests/test_tags.py \ 88 --replace test_redis_tagdb _dont_test_redis_tagdb 89 90 DJANGO_SETTINGS_MODULE=tests.settings ${python.interpreter} manage.py test 91 popd 92 93 runHook postCheck 94 ''; 95 96 pythonImportsCheck = [ "graphite" ]; 97 98 meta = with lib; { 99 description = "Enterprise scalable realtime graphing"; 100 homepage = "http://graphiteapp.org/"; 101 license = licenses.asl20; 102 maintainers = with maintainers; [ 103 offline 104 basvandijk 105 ]; 106 }; 107}