picard: 2.13.3 -> 3.0 (#570508)

This commit is contained in:
Doron Behar
2026-10-08 10:39:16 +00:00
committed by GitHub
5 changed files with 232 additions and 51 deletions

View File

@@ -1,29 +1,23 @@
{
lib,
stdenv,
python313Packages,
python3Packages,
fetchFromGitHub,
chromaprint,
gettext,
qt5,
qt6,
wrapGAppsHook3,
enablePlayback ? true,
gst_all_1,
chromaprint,
writableTmpDirAsHomeHook,
nix-update-script,
}:
let
# A few more tests fail with python314Packages, indicating the code isn't
# ready for it yet.
pythonPackages = python313Packages;
pyqt5 = if enablePlayback then pythonPackages.pyqt5-multimedia else pythonPackages.pyqt5;
in
pythonPackages.buildPythonApplication (finalAttrs: {
python3Packages.buildPythonApplication (finalAttrs: {
pname = "picard";
version = "2.13.3";
version = "3.0";
pyproject = true;
__structuredAttrs = true;
@@ -31,81 +25,79 @@ pythonPackages.buildPythonApplication (finalAttrs: {
owner = "metabrainz";
repo = "picard";
tag = "release-${finalAttrs.version}";
hash = "sha256-Q0W5Q1+PbN+yneh98jx0/UNHVfD6okX92hxNzCE+Ibc=";
hash = "sha256-aUiXmiGZTg2nQtHlE8B1/DFgvK5jLVOzN8i21fPsNk4=";
};
nativeBuildInputs = [
gettext
qt5.wrapQtAppsHook
pythonPackages.setuptools
qt6.wrapQtAppsHook
python3Packages.setuptools
wrapGAppsHook3
];
buildInputs = [
qt5.qtbase
]
++ lib.optionals (lib.meta.availableOn stdenv.hostPlatform qt5.qtwayland) [
qt5.qtwayland
]
++ lib.optionals pyqt5.multimediaEnabled [
qt5.qtmultimedia.bin
qt6.qtbase
qt6.qtmultimedia
gst_all_1.gst-libav
gst_all_1.gst-plugins-base
gst_all_1.gst-plugins-good
gst_all_1.gst-plugins-bad
]
++ lib.optionals (lib.meta.availableOn stdenv.hostPlatform qt6.qtwayland) [
qt6.qtwayland
];
pythonRelaxDeps = lib.optionals stdenv.hostPlatform.isDarwin [
# Should be resolved in the next version
"pyobjc-core"
"pyobjc-framework-Cocoa"
];
dependencies =
with pythonPackages;
dependencies = [
chromaprint # Not strictly required, but added for fpcalc in the wrapper
]
++ (
with python3Packages;
[
charset-normalizer
chromaprint
discid
fasteners
markdown
mutagen
pyjwt
pyqt5
python-dateutil
pyqt6
pygit2
pyyaml
tomlkit
]
++ 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 = [
"build"
"--disable-autoupdate"
"--localedir=${placeholder "out"}/share/locale"
# Not reporting any of these issues upstream since they are all caused by
# the restricted darwin build sandbox (no real $HOME, no access to
# /var/empty/Library, no SetFile utility), not by picard itself.
disabledTests = lib.optionals stdenv.hostPlatform.isDarwin [
"_macos"
"TestListenQueue"
];
nativeCheckInputs = [
pythonPackages.pytestCheckHook
python3Packages.pytestCheckHook
writableTmpDirAsHomeHook
];
doCheck = true;
env = {
# pygit2 needs this to initialize its TLS settings, otherwise importing
# it fails during the tests; also baked into the wrapper below for
# runtime, and for versionCheckHook.
inherit (python3Packages.pygit2) SSL_CERT_FILE;
};
# In order to spare double wrapping, we use:
dontWrapGApps = true;
dontWrapQt = true;
preFixup = ''
makeWrapperArgs+=("''${qtWrapperArgs[@]}")
makeWrapperArgs+=("''${gappsWrapperArgs[@]}")
''
+ lib.optionalString pyqt5.multimediaEnabled ''
+ lib.optionalString (lib.meta.availableOn stdenv.hostPlatform qt6.qtwayland) ''
makeWrapperArgs+=(--prefix GST_PLUGIN_SYSTEM_PATH_1_0 : "$GST_PLUGIN_SYSTEM_PATH_1_0")
'';

View File

@@ -0,0 +1,63 @@
{
buildPythonPackage,
setuptools,
darwin,
pyobjc-core,
pyobjc-framework-Cocoa,
pyobjc-framework-Quartz,
pyobjc-framework-CoreAudio,
pyobjc-framework-CoreMedia,
lib,
}:
buildPythonPackage rec {
pname = "pyobjc-framework-AVFoundation";
pyproject = true;
inherit (pyobjc-core) version src;
sourceRoot = "${src.name}/pyobjc-framework-AVFoundation";
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
pyobjc-framework-Quartz
pyobjc-framework-CoreAudio
pyobjc-framework-CoreMedia
];
env.NIX_CFLAGS_COMPILE = toString [
"-I${darwin.libffi.dev}/include"
"-Wno-error=unused-command-line-argument"
];
pythonImportsCheck = [
"AVFoundation"
];
meta = {
description = "PyObjC wrappers for the AVFoundation framework on macOS";
homepage = "https://github.com/ronaldoussoren/pyobjc/tree/main/pyobjc-framework-AVFoundation";
license = lib.licenses.mit;
platforms = lib.platforms.darwin;
maintainers = with lib.maintainers; [ doronbehar ];
};
}

View File

@@ -0,0 +1,57 @@
{
buildPythonPackage,
setuptools,
darwin,
pyobjc-core,
pyobjc-framework-Cocoa,
lib,
}:
buildPythonPackage rec {
pname = "pyobjc-framework-CoreMedia";
pyproject = true;
inherit (pyobjc-core) version src;
sourceRoot = "${src.name}/pyobjc-framework-CoreMedia";
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 = [
"CoreMedia"
];
meta = {
description = "PyObjC wrappers for the CoreMedia framework on macOS";
homepage = "https://github.com/ronaldoussoren/pyobjc/tree/main/pyobjc-framework-CoreMedia";
license = lib.licenses.mit;
platforms = lib.platforms.darwin;
maintainers = with lib.maintainers; [ doronbehar ];
};
}

View File

@@ -0,0 +1,57 @@
{
buildPythonPackage,
setuptools,
darwin,
pyobjc-core,
pyobjc-framework-AVFoundation,
lib,
}:
buildPythonPackage rec {
pname = "pyobjc-framework-MediaPlayer";
pyproject = true;
inherit (pyobjc-core) version src;
sourceRoot = "${src.name}/pyobjc-framework-MediaPlayer";
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-AVFoundation
];
env.NIX_CFLAGS_COMPILE = toString [
"-I${darwin.libffi.dev}/include"
"-Wno-error=unused-command-line-argument"
];
pythonImportsCheck = [
"MediaPlayer"
];
meta = {
description = "PyObjC wrappers for the MediaPlayer framework on macOS";
homepage = "https://github.com/ronaldoussoren/pyobjc/tree/main/pyobjc-framework-MediaPlayer";
license = lib.licenses.mit;
platforms = lib.platforms.darwin;
maintainers = with lib.maintainers; [ doronbehar ];
};
}

View File

@@ -15688,6 +15688,10 @@ self: super: with self; {
pyobjc-core = callPackage ../development/python-modules/pyobjc-core { };
pyobjc-framework-AVFoundation =
callPackage ../development/python-modules/pyobjc-framework-AVFoundation
{ };
pyobjc-framework-ApplicationServices =
callPackage ../development/python-modules/pyobjc-framework-ApplicationServices
{ };
@@ -15702,8 +15706,16 @@ self: super: with self; {
callPackage ../development/python-modules/pyobjc-framework-CoreBluetooth
{ };
pyobjc-framework-CoreMedia =
callPackage ../development/python-modules/pyobjc-framework-CoreMedia
{ };
pyobjc-framework-CoreText = callPackage ../development/python-modules/pyobjc-framework-CoreText { };
pyobjc-framework-MediaPlayer =
callPackage ../development/python-modules/pyobjc-framework-MediaPlayer
{ };
pyobjc-framework-Quartz = callPackage ../development/python-modules/pyobjc-framework-Quartz { };
pyobjc-framework-Security = callPackage ../development/python-modules/pyobjc-framework-Security { };