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 = "macholib";
22 rev = "v${version}";
23 hash = "sha256-bTql10Ceny4fBCxnEWz1m1wi03EWMDW9u99IQiWYbnY=";
24 };
25
26 build-system = [ setuptools ];
27
28 dependencies = [
29 altgraph
30 ]
31 ++ lib.optionals (pythonOlder "3.11") [
32 typing-extensions
33 ];
34
35 # Checks assume to find darwin specific libraries
36 doCheck = stdenv.buildPlatform.isDarwin;
37 nativeCheckInputs = [
38 unittestCheckHook
39 ];
40
41 passthru.tests = {
42 inherit pyinstaller; # Requires macholib for darwin
43 };
44
45 preCheck = ''
46 export PATH="$PATH:$out/bin"
47 '';
48
49 meta = with lib; {
50 description = "Analyze and edit Mach-O headers, the executable format used by Mac OS X";
51 homepage = "https://github.com/ronaldoussoren/macholib";
52 changelog = "https://github.com/ronaldoussoren/macholib/releases/tag/v${version}";
53 license = licenses.mit;
54 maintainers = with maintainers; [ eveeifyeve ];
55 };
56}