1{ lib
2, buildPythonPackage
3, ddt
4, fetchFromGitHub
5, gitdb
6, pkgs
7, pythonOlder
8, substituteAll
9, typing-extensions
10}:
11
12buildPythonPackage rec {
13 pname = "gitpython";
14 version = "3.1.37";
15 format = "setuptools";
16
17 disabled = pythonOlder "3.7";
18
19 src = fetchFromGitHub {
20 owner = "gitpython-developers";
21 repo = "GitPython";
22 rev = "refs/tags/${version}";
23 hash = "sha256-w3aSgIaD6tkxhYctkvvsdKlWXS8xU4+F0cCYeYTNHig=";
24 };
25
26 propagatedBuildInputs = [
27 ddt
28 gitdb
29 pkgs.gitMinimal
30 ] ++ lib.optionals (pythonOlder "3.10") [
31 typing-extensions
32 ];
33
34 postPatch = ''
35 substituteInPlace git/cmd.py \
36 --replace 'git_exec_name = "git"' 'git_exec_name = "${pkgs.gitMinimal}/bin/git"'
37 '';
38
39 # Tests require a git repo
40 doCheck = false;
41
42 pythonImportsCheck = [
43 "git"
44 ];
45
46 meta = with lib; {
47 description = "Python Git Library";
48 homepage = "https://github.com/gitpython-developers/GitPython";
49 changelog = "https://github.com/gitpython-developers/GitPython/blob/${version}/doc/source/changes.rst";
50 license = licenses.bsd3;
51 maintainers = with maintainers; [ fab ];
52 };
53}