push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,71 @@
{
lib,
buildPythonPackage,
cachetools,
fetchPypi,
nixosTests,
setuptools,
twisted,
txamqp,
urllib3,
whisper,
}:
buildPythonPackage rec {
pname = "carbon";
version = "1.1.10";
pyproject = true;
src = fetchPypi {
inherit pname version;
hash = "sha256-wTtbqRHMWBcM2iFN95yzwCf/BQ+EK0vp5MXT4mKX3lw=";
};
patches = [
# imp has been removed from python since version 3.12
# This patch replaces it with distutils.utils
./replace-imp.patch
];
# Carbon-s default installation is /opt/graphite. This env variable ensures
# 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;
};
pythonImportsCheck = [
"carbon"
"carbon.routers"
];
meta = {
description = "Backend data caching and persistence daemon for Graphite";
homepage = "https://github.com/graphite-project/carbon";
changelog = "https://github.com/graphite-project/carbon/releases/tag/${version}";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [
offline
basvandijk
];
};
}

View File

@@ -0,0 +1,22 @@
diff --git a/lib/carbon/routers.py b/lib/carbon/routers.py
index d1c47b7..1a70d7e 100644
--- a/lib/carbon/routers.py
+++ b/lib/carbon/routers.py
@@ -1,4 +1,4 @@
-import imp
+import importlib.util
from carbon.hashing import ConsistentHashRing, carbonHash
from carbon.util import PluginRegistrar
from six import with_metaclass
@@ -130,9 +130,8 @@ class ConsistentHashingRouter(DatapointRouter):
def setKeyFunctionFromModule(self, keyfunc_spec):
module_path, func_name = keyfunc_spec.rsplit(':', 1)
- module_file = open(module_path, 'U')
- description = ('.py', 'U', imp.PY_SOURCE)
- module = imp.load_module('keyfunc_module', module_file, module_path, description)
+ spec = importlib.util.spec_from_file_location("keyfunc_module", module_path)
+ module = importlib.util.module_from_spec(spec)
keyfunc = getattr(module, func_name)
self.setKeyFunction(keyfunc)