forgejo-lts: 7.0.10 -> 7.0.11
[NixPkgs.git] / pkgs / by-name / so / soundconverter / package.nix
blob5e5303bb1da355bcb6b08be5b1d243344f74098e
2   lib,
3   # Optional due to unfree license.
4   faacSupport ? false,
5   fetchFromGitHub,
6   glib,
7   python3Packages,
8   gtk3,
9   wrapGAppsHook3,
10   gsettings-desktop-schemas,
11   intltool,
12   xvfb-run,
13   gobject-introspection,
14   gst_all_1,
15   fdk-aac-encoder,
18 python3Packages.buildPythonApplication rec {
19   pname = "soundconverter";
20   version = "4.0.5";
22   src = fetchFromGitHub {
23     owner = "kassoulet";
24     repo = "soundconverter";
25     rev = version;
26     hash = "sha256-sno5EOh8HHfBTIE67VA8mheYp5wUMFRCbcS2EtKES3c=";
27   };
29   buildInputs = [
30     gtk3
31     fdk-aac-encoder
32     gst_all_1.gst-libav
33     gst_all_1.gst-plugins-base
34     gst_all_1.gst-plugins-good
35     gst_all_1.gst-plugins-ugly
36     (gst_all_1.gst-plugins-bad.override { inherit faacSupport; })
37   ];
39   nativeBuildInputs = [
40     intltool
41     wrapGAppsHook3
42     gobject-introspection
43   ];
45   dependencies = with python3Packages; [
46     gst-python
47     distutils-extra
48     setuptools
49     pygobject3
50   ];
52   nativeCheckInputs = [ xvfb-run ];
54   postPatch = ''
55     substituteInPlace  bin/soundconverter --replace \
56       "DATA_PATH = os.path.join(SOURCE_PATH, 'data')" \
57       "DATA_PATH = '$out/share/soundconverter'"
58   '';
60   preCheck =
61     let
62       self = {
63         outPath = "$out";
64         name = "${pname}-${version}";
65       };
66       xdgPaths = lib.concatMapStringsSep ":" glib.getSchemaDataDirPath;
67     in
68     ''
69       export HOME=$TMPDIR
70       export XDG_DATA_DIRS=$XDG_DATA_DIRS:${
71         xdgPaths [
72           gtk3
73           gsettings-desktop-schemas
74           self
75         ]
76       }
77       # FIXME: Fails due to weird Gio.file_parse_name() behavior.
78       sed -i '49 a\    @unittest.skip("Gio.file_parse_name issues")' tests/testcases/names.py
79     ''
80     + lib.optionalString (!faacSupport) ''
81       substituteInPlace tests/testcases/gui_integration.py --replace \
82         "for encoder in ['fdkaacenc', 'faac', 'avenc_aac']:" \
83         "for encoder in ['fdkaacenc', 'avenc_aac']:"
84     '';
86   checkPhase = ''
87     runHook preCheck
88     xvfb-run python tests/test.py
89     runHook postCheck
90   '';
92   # Necessary to set GDK_PIXBUF_MODULE_FILE.
93   strictDeps = false;
95   dontWrapGApps = true;
97   preFixup = ''
98     makeWrapperArgs+=("''${gappsWrapperArgs[@]}")
99   '';
101   meta = {
102     homepage = "https://soundconverter.org/";
103     description = "Leading audio file converter for the GNOME Desktop";
104     mainProgram = "soundconverter";
105     longDescription = ''
106       SoundConverter reads anything the GStreamer library can read,
107       and writes WAV, FLAC, MP3, AAC and Ogg Vorbis files.
108       Uses Python and GTK+ GUI toolkit, and runs on X Window System.
109     '';
110     license = lib.licenses.gpl3Only;
111     platforms = lib.platforms.linux;
112     maintainers = with lib.maintainers; [
113       jakubgs
114       aleksana
115     ];
116   };