1{ lib, stdenv
2, buildPythonPackage
3, fetchPypi
4, setuptools
5, nose
6, pkgs
7}:
8
9buildPythonPackage rec {
10 pname = "pycdio";
11 version = "2.1.1";
12
13 src = fetchPypi {
14 inherit pname version;
15 sha256 = "61734db8c554b7b1a2cb2da2e2c15d3f9f5973a57cfb06f8854c38029004a9f8";
16 };
17
18 prePatch = ''
19 substituteInPlace setup.py \
20 --replace 'library_dirs=library_dirs' 'library_dirs=[dir.decode("utf-8") for dir in library_dirs]' \
21 --replace 'include_dirs=include_dirs' 'include_dirs=[dir.decode("utf-8") for dir in include_dirs]' \
22 --replace 'runtime_library_dirs=runtime_lib_dirs' 'runtime_library_dirs=[dir.decode("utf-8") for dir in runtime_lib_dirs]'
23 '';
24
25 preConfigure = ''
26 patchShebangs .
27 '';
28
29 nativeBuildInputs = [ nose pkgs.pkg-config pkgs.swig ];
30 buildInputs = [ setuptools pkgs.libcdio ]
31 ++ lib.optional stdenv.isDarwin pkgs.libiconv;
32
33 # Run tests using nosetests but first need to install the binaries
34 # to the root source directory where they can be found.
35 checkPhase = ''
36 ./setup.py install_lib -d .
37 nosetests
38 '';
39
40 meta = with lib; {
41 homepage = "https://www.gnu.org/software/libcdio/";
42 description = "Wrapper around libcdio (CD Input and Control library)";
43 license = licenses.gpl3Plus;
44 };
45
46}