Unverified Commit 44600125 authored by Aleksana's avatar Aleksana Committed by GitHub
Browse files

jellyfin-mpv-shim: fix build on darwin (#439766)

parents 19e2a256 6b134352
Loading
Loading
Loading
Loading
+65 −0
Original line number Diff line number Diff line
{
  buildPythonPackage,
  fetchFromGitHub,
  setuptools,
  darwin,
  pyobjc-core,
  pyobjc-framework-Cocoa,
  lib,
}:

buildPythonPackage rec {
  pname = "pyobjc-framework-Quartz";
  version = "11.1";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "ronaldoussoren";
    repo = "pyobjc";
    tag = "v${version}";
    hash = "sha256-2qPGJ/1hXf3k8AqVLr02fVIM9ziVG9NMrm3hN1de1Us=";
  };

  sourceRoot = "${src.name}/pyobjc-framework-Quartz";

  build-system = [ setuptools ];

  buildInputs = [ darwin.libffi ];

  nativeBuildInputs = [
    darwin.DarwinTools # sw_vers
  ];

  # See https://github.com/ronaldoussoren/pyobjc/pull/641. Unfortunately, we
  # cannot just pull that diff with fetchpatch due to https://discourse.nixos.org/t/how-to-apply-patches-with-sourceroot/59727.
  postPatch = ''
    substituteInPlace pyobjc_setup.py \
      --replace-fail "-buildversion" "-buildVersion" \
      --replace-fail "-productversion" "-productVersion" \
      --replace-fail "/usr/bin/sw_vers" "sw_vers" \
      --replace-fail "/usr/bin/xcrun" "xcrun"
  '';

  dependencies = [
    pyobjc-core
    pyobjc-framework-Cocoa
  ];

  env.NIX_CFLAGS_COMPILE = toString [
    "-I${darwin.libffi.dev}/include"
    "-Wno-error=unused-command-line-argument"
  ];

  pythonImportsCheck = [
    "Quartz"
    "PyObjCTools"
  ];

  meta = {
    description = "PyObjC wrappers for the Quartz frameworks on macOS";
    homepage = "https://github.com/ronaldoussoren/pyobjc";
    license = lib.licenses.mit;
    platforms = lib.platforms.darwin;
    maintainers = with lib.maintainers; [ xyenon ];
  };
}
+65 −0
Original line number Diff line number Diff line
{
  buildPythonPackage,
  fetchFromGitHub,
  setuptools,
  darwin,
  pyobjc-core,
  pyobjc-framework-Cocoa,
  lib,
}:

buildPythonPackage rec {
  pname = "pyobjc-framework-Security";
  version = "11.1";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "ronaldoussoren";
    repo = "pyobjc";
    tag = "v${version}";
    hash = "sha256-2qPGJ/1hXf3k8AqVLr02fVIM9ziVG9NMrm3hN1de1Us=";
  };

  sourceRoot = "${src.name}/pyobjc-framework-Security";

  build-system = [ setuptools ];

  buildInputs = [ darwin.libffi ];

  nativeBuildInputs = [
    darwin.DarwinTools # sw_vers
  ];

  # See https://github.com/ronaldoussoren/pyobjc/pull/641. Unfortunately, we
  # cannot just pull that diff with fetchpatch due to https://discourse.nixos.org/t/how-to-apply-patches-with-sourceroot/59727.
  postPatch = ''
    substituteInPlace pyobjc_setup.py \
      --replace-fail "-buildversion" "-buildVersion" \
      --replace-fail "-productversion" "-productVersion" \
      --replace-fail "/usr/bin/sw_vers" "sw_vers" \
      --replace-fail "/usr/bin/xcrun" "xcrun"
  '';

  dependencies = [
    pyobjc-core
    pyobjc-framework-Cocoa
  ];

  env.NIX_CFLAGS_COMPILE = toString [
    "-I${darwin.libffi.dev}/include"
    "-Wno-error=unused-command-line-argument"
  ];

  pythonImportsCheck = [
    "Security"
    "PyObjCTools"
  ];

  meta = {
    description = "PyObjC wrappers for the Security frameworks on macOS";
    homepage = "https://github.com/ronaldoussoren/pyobjc";
    license = lib.licenses.mit;
    platforms = lib.platforms.darwin;
    maintainers = with lib.maintainers; [ xyenon ];
  };
}
+66 −0
Original line number Diff line number Diff line
{
  buildPythonPackage,
  fetchFromGitHub,
  setuptools,
  darwin,
  pyobjc-core,
  pyobjc-framework-Cocoa,
  lib,
}:

buildPythonPackage rec {
  pname = "pyobjc-framework-WebKit";
  version = "11.1";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "ronaldoussoren";
    repo = "pyobjc";
    tag = "v${version}";
    hash = "sha256-2qPGJ/1hXf3k8AqVLr02fVIM9ziVG9NMrm3hN1de1Us=";
  };

  sourceRoot = "${src.name}/pyobjc-framework-WebKit";

  build-system = [ setuptools ];

  buildInputs = [ darwin.libffi ];

  nativeBuildInputs = [
    darwin.DarwinTools # sw_vers
  ];

  # See https://github.com/ronaldoussoren/pyobjc/pull/641. Unfortunately, we
  # cannot just pull that diff with fetchpatch due to https://discourse.nixos.org/t/how-to-apply-patches-with-sourceroot/59727.
  postPatch = ''
    substituteInPlace pyobjc_setup.py \
      --replace-fail "-buildversion" "-buildVersion" \
      --replace-fail "-productversion" "-productVersion" \
      --replace-fail "/usr/bin/sw_vers" "sw_vers" \
      --replace-fail "/usr/bin/xcrun" "xcrun"
  '';

  dependencies = [
    pyobjc-core
    pyobjc-framework-Cocoa
  ];

  env.NIX_CFLAGS_COMPILE = toString [
    "-I${darwin.libffi.dev}/include"
    "-Wno-error=unused-command-line-argument"
  ];

  pythonImportsCheck = [
    "WebKit"
    "JavaScriptCore"
    "PyObjCTools"
  ];

  meta = {
    description = "PyObjC wrappers for the WebKit frameworks on macOS";
    homepage = "https://github.com/ronaldoussoren/pyobjc";
    license = lib.licenses.mit;
    platforms = lib.platforms.darwin;
    maintainers = with lib.maintainers; [ xyenon ];
  };
}
+14 −12
Original line number Diff line number Diff line
@@ -3,15 +3,17 @@
  buildPythonPackage,
  fetchFromGitHub,
  fetchpatch,
  gobject-introspection,
  setuptools,
  pillow,
  xlib,
  six,
  xvfb-run,
  setuptools,
  gobject-introspection,
  pygobject3,
  gtk3,
  stdenv,
  xlib,
  libayatana-appindicator,
  pyobjc-framework-Quartz,
  xvfb-run,
  pytest,
}:

@@ -48,22 +50,22 @@ buildPythonPackage rec {

  propagatedBuildInputs = [
    pillow
    xlib
    six
    pygobject3
    gtk3
  ]
  ++ lib.optionals stdenv.hostPlatform.isLinux [
    xlib
    libayatana-appindicator
  ];
  ]
  ++ lib.optionals stdenv.isDarwin [ pyobjc-framework-Quartz ];

  nativeCheckInputs = [
    pytest
    xvfb-run
  ];
  nativeCheckInputs = [ pytest ] ++ lib.optionals stdenv.hostPlatform.isLinux [ xvfb-run ];

  checkPhase = ''
    runHook preCheck

    xvfb-run -s '-screen 0 800x600x24' pytest tests/menu_descriptor_tests.py
    ${lib.optionalString stdenv.hostPlatform.isLinux "xvfb-run -s '-screen 0 800x600x24' "}pytest tests/menu_descriptor_tests.py

    runHook postCheck
  '';
@@ -75,7 +77,7 @@ buildPythonPackage rec {
      gpl3Plus
      lgpl3Plus
    ];
    platforms = platforms.linux;
    platforms = platforms.all;
    maintainers = with maintainers; [ jojosch ];
  };
}
+13 −0
Original line number Diff line number Diff line
@@ -9,6 +9,12 @@
  qtpy,
  six,
  typing-extensions,
  stdenv,
  pyobjc-core,
  pyobjc-framework-Cocoa,
  pyobjc-framework-Quartz,
  pyobjc-framework-Security,
  pyobjc-framework-WebKit,
}:

buildPythonPackage rec {
@@ -32,6 +38,13 @@ buildPythonPackage rec {
    qtpy
    six
    typing-extensions
  ]
  ++ lib.optionals stdenv.hostPlatform.isDarwin [
    pyobjc-core
    pyobjc-framework-Cocoa
    pyobjc-framework-Quartz
    pyobjc-framework-Security
    pyobjc-framework-WebKit
  ];

  pythonImportsCheck = [ "webview" ];
Loading