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