1{
2 buildPythonPackage,
3 darwin,
4 fetchFromGitHub,
5 lib,
6 pyobjc-core,
7 setuptools,
8}:
9
10buildPythonPackage rec {
11 pname = "pyobjc-framework-Cocoa";
12 version = "11.0";
13 pyproject = true;
14
15 src = fetchFromGitHub {
16 owner = "ronaldoussoren";
17 repo = "pyobjc";
18 tag = "v${version}";
19 hash = "sha256-RhB0Ht6vyDxYwDGS+A9HZL9ySIjWlhdB4S+gHxvQQBg=";
20 };
21
22 sourceRoot = "source/pyobjc-framework-Cocoa";
23
24 build-system = [ setuptools ];
25
26 buildInputs = [
27 darwin.libffi
28 darwin.DarwinTools
29 ];
30
31 nativeBuildInputs = [
32 darwin.DarwinTools # sw_vers
33 ];
34
35 # See https://github.com/ronaldoussoren/pyobjc/pull/641. Unfortunately, we
36 # cannot just pull that diff with fetchpatch due to https://discourse.nixos.org/t/how-to-apply-patches-with-sourceroot/59727.
37 postPatch = ''
38 substituteInPlace pyobjc_setup.py \
39 --replace-fail "-buildversion" "-buildVersion" \
40 --replace-fail "-productversion" "-productVersion"
41 '';
42
43 dependencies = [ pyobjc-core ];
44
45 env.NIX_CFLAGS_COMPILE = toString [
46 "-I${darwin.libffi.dev}/include"
47 "-Wno-error=unused-command-line-argument"
48 ];
49
50 pythonImportsCheck = [ "Cocoa" ];
51
52 meta = with lib; {
53 description = "PyObjC wrappers for the Cocoa frameworks on macOS";
54 homepage = "https://github.com/ronaldoussoren/pyobjc";
55 license = licenses.mit;
56 platforms = platforms.darwin;
57 maintainers = with maintainers; [ samuela ];
58 };
59}