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