Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions pkgs/development/python-modules/graphite-web/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
pkgs,
buildPythonPackage,
fetchFromGitHub,
fetchpatch,

# build-system
setuptools,

# dependencies
cairocffi,
Expand Down Expand Up @@ -31,16 +35,21 @@

buildPythonPackage {
pname = "graphite-web";
version = "1.1.10-unstable-2025-02-24";
version = "1.2.1-pre2";
pyproject = true;

src = fetchFromGitHub {
owner = "graphite-project";
repo = "graphite-web";
rev = "49c28e2015d605ad9ec93524f7076dd924a4731a";
hash = "sha256-TxsQPhnI5WhQvKKkDEYZ8xnyg/qf+N9Icej6d6A0jC0=";
tag = "1.2.1-pre2";
hash = "sha256-2C5iWn5/BoX0OPT/UQO94V1oZ/xiRzgoipp0551dnpM=";
};

patches = [
# https://github.com/graphite-project/graphite-web/pull/2914
./epoch-django5-localize-via-pytz.patch
];

postPatch = ''
substituteInPlace webapp/graphite/settings.py \
--replace-fail \
Expand All @@ -54,6 +63,8 @@ buildPythonPackage {
--replace-fail "test_render_view" "_dont_test_render_view"
'';

build-system = [ setuptools ];

dependencies = [
cairocffi
django
Expand Down Expand Up @@ -89,9 +100,12 @@ buildPythonPackage {
];

preCheck =
# Start a redis server
# Start a redis server on a per-build port. Darwin builds share the host
# network (no netns isolation), so concurrent builds would otherwise
# collide on the default port 6379. test_redis_tagdb reads TEST_REDIS_PORT.
''
${pkgs.valkey}/bin/redis-server &
export TEST_REDIS_PORT=$(( ($$ % 20000) + 20000 ))
${pkgs.valkey}/bin/redis-server --port "$TEST_REDIS_PORT" &
REDIS_PID=$!
'';

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/webapp/graphite/util.py b/webapp/graphite/util.py
index bb46fa16c..7152cb765 100644
--- a/webapp/graphite/util.py
+++ b/webapp/graphite/util.py
@@ -59,7 +59,7 @@ def epoch(dt):
if not dt.tzinfo:
tb = traceback.extract_stack(None, 2)
log.warning('epoch() called with non-timezone-aware datetime in %s at %s:%d' % (tb[0][2], tb[0][0], tb[0][1]))
- return calendar.timegm(make_aware(dt, pytz.timezone(settings.TIME_ZONE)).astimezone(pytz.utc).timetuple())
+ return calendar.timegm(pytz.timezone(settings.TIME_ZONE).localize(dt, is_dst=None).astimezone(pytz.utc).timetuple())
return calendar.timegm(dt.astimezone(pytz.utc).timetuple())


Loading