1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fonttools,
6 git,
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 doCheck = true;
30 nativeCheckInputs = [
31 git
32 pytestCheckHook
33 ];
34 preCheck = ''
35 # Many tests assume they are running from a git checkout, although they
36 # don't care which one. Create a dummy git repo to satisfy the tests:
37 git init -b main
38 git config user.email test@example.invalid
39 git config user.name Test
40 git commit --allow-empty --message 'Dummy commit for tests'
41 '';
42 disabledTests = [
43 # These tests assume they are actually running from a font-v git checkout,
44 # so just skip them:
45 "test_utilities_get_gitrootpath_function"
46 ];
47
48 meta = with lib; {
49 description = "Python utility for manipulating font version headers";
50 mainProgram = "font-v";
51 homepage = "https://github.com/source-foundry/font-v";
52 license = licenses.mit;
53 maintainers = with maintainers; [ danc86 ];
54 };
55}