1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pretend,
6 pytestCheckHook,
7 setuptools,
8}:
9
10let
11 self = buildPythonPackage rec {
12 pname = "calver";
13 version = "2025.04.01";
14 pyproject = true;
15
16 src = fetchFromGitHub {
17 owner = "di";
18 repo = "calver";
19 rev = version;
20 hash = "sha256-F7OnhwlwCw6cZeigmzyyIkttQMfxFoC2ynpxw0FGYMo=";
21 };
22
23 postPatch = ''
24 substituteInPlace setup.py \
25 --replace "version=calver_version(True)" 'version="${version}"'
26 '';
27
28 build-system = [ setuptools ];
29
30 doCheck = false; # avoid infinite recursion with hatchling
31
32 nativeCheckInputs = [
33 pretend
34 pytestCheckHook
35 ];
36
37 preCheck = ''
38 unset SOURCE_DATE_EPOCH
39 '';
40
41 pythonImportsCheck = [ "calver" ];
42
43 passthru.tests.calver = self.overridePythonAttrs { doCheck = true; };
44
45 meta = {
46 changelog = "https://github.com/di/calver/releases/tag/${src.rev}";
47 description = "Setuptools extension for CalVer package versions";
48 homepage = "https://github.com/di/calver";
49 license = lib.licenses.asl20;
50 maintainers = with lib.maintainers; [ dotlambda ];
51 };
52 };
53in
54self