Unverified Commit 48484599 authored by Doron Behar's avatar Doron Behar Committed by GitHub
Browse files

picard: fix eval & build on Darwin with avoiding unsupported dependencies (#515936)

parents 9713637e 11b7ca89
Loading
Loading
Loading
Loading
+56 −24
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  python312Packages,
  fetchFromGitHub,

@@ -9,6 +10,8 @@

  enablePlayback ? true,
  gst_all_1,

  writableTmpDirAsHomeHook,
}:

let
@@ -19,7 +22,9 @@ pythonPackages.buildPythonApplication (finalAttrs: {
  pname = "picard";
  # nix-update --commit picard --version-regex 'release-(.*)'
  version = "2.13.3";
  format = "setuptools";
  pyproject = true;
  strictDeps = true;
  __structuredAttrs = true;

  src = fetchFromGitHub {
    owner = "metabrainz";
@@ -31,25 +36,37 @@ pythonPackages.buildPythonApplication (finalAttrs: {
  nativeBuildInputs = [
    gettext
    qt5.wrapQtAppsHook
    pythonPackages.pytestCheckHook
  ]
  ++ lib.optionals (pyqt5.multimediaEnabled) [
    gst_all_1.gst-libav
    gst_all_1.gst-plugins-base
    gst_all_1.gst-plugins-good
    gst_all_1.gst-vaapi
    gst_all_1.gstreamer
    pythonPackages.setuptools
  ];

  buildInputs = [
    qt5.qtbase
  ]
  ++ lib.optionals (lib.meta.availableOn stdenv.hostPlatform qt5.qtwayland) [
    qt5.qtwayland
  ]
  ++ lib.optionals (pyqt5.multimediaEnabled) [
  ++ lib.optionals (pyqt5.multimediaEnabled) (
    [
      qt5.qtmultimedia.bin
      gst_all_1.gst-libav
      gst_all_1.gst-plugins-base
      gst_all_1.gst-plugins-good
    ]
    ++ lib.optionals (lib.meta.availableOn stdenv.hostPlatform gst_all_1.gst-vaapi) [
      gst_all_1.gst-vaapi
    ]
  );

  pythonRelaxDeps = lib.optionals stdenv.hostPlatform.isDarwin [
    # Should be resolved in the next version
    "pyobjc-core"
    "pyobjc-framework-Cocoa"
  ];

  propagatedBuildInputs = with pythonPackages; [
  propagatedBuildInputs =
    with pythonPackages;
    [
      charset-normalizer
      chromaprint
      discid
      fasteners
@@ -59,6 +76,20 @@ pythonPackages.buildPythonApplication (finalAttrs: {
      pyqt5
      python-dateutil
      pyyaml
    ]
    ++ lib.optionals stdenv.hostPlatform.isDarwin [
      pyobjc-core
      pyobjc-framework-Cocoa
    ];

  # Not reporting any of these issues because the next upstream version will
  # include many breaking changes and this might not be relevant.
  disabledTestPaths = lib.optionals stdenv.hostPlatform.isDarwin [
    "test/test_const_appdirs.py::AppPathsTest::test_cache_folder_macos" # - AssertionError: '/nix/var/nix/builds/nix-54642-966088698/.h[33 chars]card' ...
    "test/test_const_appdirs.py::AppPathsTest::test_config_folder_macos" # - AssertionError: '/nix/var/nix/builds/nix-54642-966088698/.h[38 chars]card' ...
    "test/test_const_appdirs.py::AppPathsTest::test_plugin_folder_macos" # - AssertionError: '/nix/var/nix/builds/nix-54642-966088698/.h[46 chars]gins' ...
    "test/test_plugins.py" # Various PermissionError for /var/empty/Library - hopefully will be resolved in the next release.
    "test/test_utils.py::HiddenFileTest::test_macos" # - FileNotFoundError: [Errno 2] No such file or directory: 'SetFile'
  ];

  setupPyGlobalFlags = [
@@ -67,9 +98,10 @@ pythonPackages.buildPythonApplication (finalAttrs: {
    "--localedir=${placeholder "out"}/share/locale"
  ];

  preCheck = ''
    export HOME=$(mktemp -d)
  '';
  nativeCheckInputs = [
    pythonPackages.pytestCheckHook
    writableTmpDirAsHomeHook
  ];
  doCheck = true;

  # In order to spare double wrapping, we use: