1{ lib 2, buildPythonPackage 3, fetchFromGitHub 4, build 5, coverage 6, git 7, packaging 8, pytestCheckHook 9, pytest-rerunfailures 10, pythonOlder 11, setuptools 12, toml 13, wheel 14}: 15 16buildPythonPackage rec { 17 pname = "setuptools-git-versioning"; 18 version = "1.13.5"; 19 format = "pyproject"; 20 21 src = fetchFromGitHub { 22 owner = "dolfinus"; 23 repo = "setuptools-git-versioning"; 24 rev = "refs/tags/v${version}"; 25 hash = "sha256-MAHB6hMAcMo1+HCc6g7xQUD2sG+TLjM/6Oa/BKuXpRc="; 26 }; 27 28 nativeBuildInputs = [ 29 setuptools 30 wheel 31 ]; 32 33 propagatedBuildInputs = [ 34 packaging 35 setuptools 36 ] ++ lib.optionals (pythonOlder "3.11") [ 37 toml 38 ]; 39 40 pythonImportsCheck = [ 41 "setuptools_git_versioning" 42 ]; 43 44 nativeCheckInputs = [ 45 build 46 coverage 47 git 48 pytestCheckHook 49 pytest-rerunfailures 50 toml 51 ]; 52 53 preCheck = '' 54 # so that its built binary is accessible by tests 55 export PATH="$out/bin:$PATH" 56 ''; 57 58 # limit tests because the full suite takes several minutes to run 59 pytestFlagsArray = [ "-m" "important" ]; 60 61 disabledTests = [ 62 # runs an isolated build that uses internet to download dependencies 63 "test_config_not_used" 64 ]; 65 66 meta = with lib; { 67 description = "Use git repo data (latest tag, current commit hash, etc) for building a version number according PEP-440"; 68 homepage = "https://github.com/dolfinus/setuptools-git-versioning"; 69 changelog = "https://github.com/dolfinus/setuptools-git-versioning/blob/${src.rev}/CHANGELOG.rst"; 70 license = licenses.mit; 71 maintainers = with maintainers; [ tjni ]; 72 }; 73}