1{
2 lib,
3 stdenv,
4 libdiscid,
5 buildPythonPackage,
6 fetchPypi,
7 setuptools,
8}:
9
10buildPythonPackage rec {
11 pname = "discid";
12 version = "1.3.0";
13 pyproject = true;
14
15 src = fetchPypi {
16 inherit pname version;
17 sha256 = "sha256-cWChIRrD1qbYIT+4jdPXPjKr5eATNqWkyYWwgql9QzU=";
18 };
19
20 build-system = [
21 setuptools
22 ];
23
24 patchPhase =
25 let
26 extension = stdenv.hostPlatform.extensions.sharedLibrary;
27 in
28 ''
29 substituteInPlace discid/libdiscid.py \
30 --replace "_open_library(_LIB_NAME)" \
31 "_open_library('${libdiscid}/lib/libdiscid${extension}')"
32 '';
33
34 meta = with lib; {
35 description = "Python binding of libdiscid";
36 homepage = "https://python-discid.readthedocs.org/";
37 license = licenses.lgpl3Plus;
38 };
39}