1{
2 lib,
3 buildPythonPackage,
4 pythonOlder,
5 fetchPypi,
6 importlib-metadata,
7 packaging,
8 tomli,
9 pytestCheckHook,
10 build,
11 hatchling,
12 pydantic,
13 pytest-mock,
14 setuptools,
15 git,
16 mercurial,
17}:
18
19buildPythonPackage rec {
20 pname = "versioningit";
21 version = "3.1.0";
22 format = "pyproject";
23
24 disabled = pythonOlder "3.8";
25
26 src = fetchPypi {
27 inherit pname version;
28 hash = "sha256-eqxxPDGlPrNnprvC6LPejMK4bRDUXFEBr9ZRRGyxD9c=";
29 };
30
31 postPatch = ''
32 substituteInPlace tox.ini \
33 --replace "--cov=versioningit" "" \
34 --replace "--cov-config=tox.ini" "" \
35 --replace "--no-cov-on-fail" ""
36 '';
37
38 nativeBuildInputs = [ hatchling ];
39
40 propagatedBuildInputs =
41 [ packaging ]
42 ++ lib.optionals (pythonOlder "3.10") [ importlib-metadata ]
43 ++ lib.optionals (pythonOlder "3.11") [ tomli ];
44
45 nativeCheckInputs = [
46 pytestCheckHook
47 build
48 hatchling
49 pydantic
50 pytest-mock
51 setuptools
52 git
53 mercurial
54 ];
55
56 disabledTests = [
57 # wants to write to the Nix store
58 "test_editable_mode"
59 ];
60
61 pythonImportsCheck = [ "versioningit" ];
62
63 meta = with lib; {
64 description = "setuptools plugin for determining package version from VCS";
65 mainProgram = "versioningit";
66 homepage = "https://github.com/jwodder/versioningit";
67 changelog = "https://versioningit.readthedocs.io/en/latest/changelog.html";
68 license = licenses.mit;
69 maintainers = with maintainers; [ DeeUnderscore ];
70 };
71}