1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 build, 6 coverage, 7 git, 8 packaging, 9 pytestCheckHook, 10 pytest-rerunfailures, 11 pythonOlder, 12 setuptools, 13 toml, 14 tomli, 15}: 16 17buildPythonPackage rec { 18 pname = "setuptools-git-versioning"; 19 version = "2.1.0"; 20 format = "pyproject"; 21 22 src = fetchFromGitHub { 23 owner = "dolfinus"; 24 repo = "setuptools-git-versioning"; 25 tag = "v${version}"; 26 hash = "sha256-Slf6tq83LajdTnr98SuCiFIdm/6auzftnARLAOBgyng="; 27 }; 28 29 build-system = [ 30 setuptools 31 ]; 32 33 dependencies = [ 34 packaging 35 setuptools 36 ] ++ lib.optionals (pythonOlder "3.11") [ tomli ]; 37 38 pythonImportsCheck = [ "setuptools_git_versioning" ]; 39 40 nativeCheckInputs = [ 41 build 42 coverage 43 git 44 pytestCheckHook 45 pytest-rerunfailures 46 toml 47 ]; 48 49 preCheck = '' 50 # so that its built binary is accessible by tests 51 export PATH="$out/bin:$PATH" 52 ''; 53 54 # limit tests because the full suite takes several minutes to run 55 pytestFlagsArray = [ 56 "-m" 57 "important" 58 ]; 59 60 disabledTests = [ 61 # runs an isolated build that uses internet to download dependencies 62 "test_config_not_used" 63 ]; 64 65 meta = with lib; { 66 description = "Use git repo data (latest tag, current commit hash, etc) for building a version number according PEP-440"; 67 mainProgram = "setuptools-git-versioning"; 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}