nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 81 lines 1.7 kB view raw
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 tomli, 14 tomli-w, 15}: 16 17buildPythonPackage rec { 18 pname = "setuptools-git-versioning"; 19 version = "3.0.1"; 20 pyproject = true; 21 22 src = fetchFromGitHub { 23 owner = "dolfinus"; 24 repo = "setuptools-git-versioning"; 25 tag = "v${version}"; 26 hash = "sha256-rAJ9OvSKhQ3sMN5DlUg2tfR42Ae7jjz9en3gfRnXb3I="; 27 }; 28 29 postPatch = '' 30 substituteInPlace pyproject.toml \ 31 --replace-fail 'dynamic = ["version"]' 'version = "${version}"' 32 ''; 33 34 build-system = [ 35 packaging 36 setuptools 37 ] 38 ++ lib.optionals (pythonOlder "3.11") [ 39 tomli 40 ]; 41 42 dependencies = [ 43 packaging 44 setuptools 45 ] 46 ++ lib.optionals (pythonOlder "3.11") [ tomli ]; 47 48 pythonImportsCheck = [ "setuptools_git_versioning" ]; 49 50 nativeCheckInputs = [ 51 build 52 coverage 53 git 54 pytestCheckHook 55 pytest-rerunfailures 56 tomli-w 57 ]; 58 59 preCheck = '' 60 # so that its built binary is accessible by tests 61 export PATH="$out/bin:$PATH" 62 ''; 63 64 # limit tests because the full suite takes several minutes to run 65 enabledTestMarks = [ 66 "important" 67 ]; 68 69 disabledTests = [ 70 # runs an isolated build that uses internet to download dependencies 71 "test_config_not_used" 72 ]; 73 74 meta = { 75 description = "Use git repo data (latest tag, current commit hash, etc) for building a version number according PEP-440"; 76 mainProgram = "setuptools-git-versioning"; 77 homepage = "https://github.com/dolfinus/setuptools-git-versioning"; 78 changelog = "https://github.com/dolfinus/setuptools-git-versioning/blob/${src.tag}/CHANGELOG.rst"; 79 license = lib.licenses.mit; 80 }; 81}