about summary refs log tree commit diff
path: root/pkgs/development/python-modules/carbon/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/carbon/default.nix')
-rw-r--r--pkgs/development/python-modules/carbon/default.nix54
1 files changed, 47 insertions, 7 deletions
diff --git a/pkgs/development/python-modules/carbon/default.nix b/pkgs/development/python-modules/carbon/default.nix
index f6647abbc57e..4b253740d6d6 100644
--- a/pkgs/development/python-modules/carbon/default.nix
+++ b/pkgs/development/python-modules/carbon/default.nix
@@ -1,10 +1,24 @@
-{ lib, buildPythonPackage, fetchPypi, twisted, whisper, txamqp, cachetools, urllib3
+{
+  lib,
+  buildPythonPackage,
+  cachetools,
+  fetchPypi,
+  nixosTests,
+  pytestCheckHook,
+  pythonOlder,
+  setuptools,
+  twisted,
+  txamqp,
+  urllib3,
+  whisper,
 }:
 
 buildPythonPackage rec {
   pname = "carbon";
   version = "1.1.10";
-  format = "setuptools";
+  pyproject = true;
+
+  disabled = pythonOlder "3.10";
 
   src = fetchPypi {
     inherit pname version;
@@ -12,15 +26,41 @@ buildPythonPackage rec {
   };
 
   # Carbon-s default installation is /opt/graphite. This env variable ensures
-  # carbon is installed as a regular python module.
-  GRAPHITE_NO_PREFIX="True";
+  # carbon is installed as a regular Python module.
+  GRAPHITE_NO_PREFIX = "True";
+
+  postPatch = ''
+    substituteInPlace setup.py \
+      --replace-fail "cf.readfp(f, 'setup.cfg')" "cf.read(f, 'setup.cfg')"
+  '';
+
+  build-system = [ setuptools ];
+
+  dependencies = [
+    cachetools
+    twisted
+    txamqp
+    urllib3
+    whisper
+  ];
+
+  # Tests are not shipped with PyPI
+  doCheck = false;
+
+  passthru.tests = {
+    inherit (nixosTests) graphite;
+  };
 
-  propagatedBuildInputs = [ twisted whisper txamqp cachetools urllib3 ];
+  pythonImportsCheck = [ "carbon" ];
 
   meta = with lib; {
-    homepage = "http://graphiteapp.org/";
     description = "Backend data caching and persistence daemon for Graphite";
-    maintainers = with maintainers; [ offline basvandijk ];
+    homepage = "https://github.com/graphite-project/carbon";
+    changelog = "https://github.com/graphite-project/carbon/releases/tag/${version}";
     license = licenses.asl20;
+    maintainers = with maintainers; [
+      offline
+      basvandijk
+    ];
   };
 }