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