1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 pythonOlder,
7 unittestCheckHook,
8 altgraph,
9 setuptools,
10 typing-extensions,
11 pyinstaller,
12}:
13
14buildPythonPackage rec {
15 pname = "macholib";
16 version = "1.16.3";
17 pyproject = true;
18
19 src = fetchFromGitHub {
20 owner = "ronaldoussoren";
21 repo = pname;
22 rev = "v${version}";
23 hash = "sha256-bTql10Ceny4fBCxnEWz1m1wi03EWMDW9u99IQiWYbnY=";
24 };
25
26 build-system = [ setuptools ];
27
28 dependencies =
29 [
30 altgraph
31 ]
32 ++ lib.optionals (pythonOlder "3.11") [
33 typing-extensions
34 ];
35
36 # Checks assume to find darwin specific libraries
37 doCheck = stdenv.buildPlatform.isDarwin;
38 nativeCheckInputs = [
39 unittestCheckHook
40 ];
41
42 passthru.tests = {
43 inherit pyinstaller; # Requires macholib for darwin
44 };
45
46 preCheck = ''
47 export PATH="$PATH:$out/bin"
48 '';
49
50 meta = with lib; {
51 description = "Analyze and edit Mach-O headers, the executable format used by Mac OS X.";
52 homepage = "https://github.com/ronaldoussoren/macholib";
53 changelog = "https://github.com/ronaldoussoren/macholib/releases/tag/v${version}";
54 license = licenses.mit;
55 maintainers = with maintainers; [ eveeifyeve ];
56 };
57}