1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fonttools,
6 gitMinimal,
7 gitpython,
8 pytestCheckHook,
9}:
10
11buildPythonPackage rec {
12 pname = "font-v";
13 version = "2.1.0";
14 format = "setuptools";
15
16 # PyPI source tarballs omit tests, fetch from Github instead
17 src = fetchFromGitHub {
18 owner = "source-foundry";
19 repo = "font-v";
20 rev = "v${version}";
21 hash = "sha256-ceASyYcNul5aWPAPGajCQrqsQ3bN1sE+nMbCbj7f35w=";
22 };
23
24 propagatedBuildInputs = [
25 fonttools
26 gitpython
27 ];
28
29 nativeCheckInputs = [
30 gitMinimal
31 pytestCheckHook
32 ];
33 preCheck = ''
34 # Many tests assume they are running from a git checkout, although they
35 # don't care which one. Create a dummy git repo to satisfy the tests:
36 git init -b main
37 git config user.email test@example.invalid
38 git config user.name Test
39 git commit --allow-empty --message 'Dummy commit for tests'
40 '';
41 disabledTests = [
42 # These tests assume they are actually running from a font-v git checkout,
43 # so just skip them:
44 "test_utilities_get_gitrootpath_function"
45 ];
46
47 meta = with lib; {
48 description = "Python utility for manipulating font version headers";
49 mainProgram = "font-v";
50 homepage = "https://github.com/source-foundry/font-v";
51 license = licenses.mit;
52 maintainers = with maintainers; [ danc86 ];
53 };
54}