3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/development/python-modules/pycdio/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

48 lines
1.3 KiB
Nix

{ lib, stdenv
, buildPythonPackage
, fetchPypi
, setuptools
, nose
, pkgs
}:
buildPythonPackage rec {
pname = "pycdio";
version = "2.1.0";
src = fetchPypi {
inherit pname version;
sha256 = "01b7vqqfry071p60sabydym7r3m3rxszyqpdbs1qi5rk2sfyblnn";
};
prePatch = ''
substituteInPlace setup.py \
--replace 'library_dirs=library_dirs' 'library_dirs=[dir.decode("utf-8") for dir in library_dirs]' \
--replace 'include_dirs=include_dirs' 'include_dirs=[dir.decode("utf-8") for dir in include_dirs]' \
--replace 'runtime_library_dirs=runtime_lib_dirs' 'runtime_library_dirs=[dir.decode("utf-8") for dir in runtime_lib_dirs]'
'';
preConfigure = ''
patchShebangs .
'';
nativeBuildInputs = [ nose pkgs.pkgconfig pkgs.swig ];
buildInputs = [ setuptools pkgs.libcdio ]
++ stdenv.lib.optional stdenv.isDarwin pkgs.libiconv;
# Run tests using nosetests but first need to install the binaries
# to the root source directory where they can be found.
checkPhase = ''
./setup.py install_lib -d .
nosetests
'';
meta = with lib; {
homepage = "https://www.gnu.org/software/libcdio/";
description = "Wrapper around libcdio (CD Input and Control library)";
maintainers = with maintainers; [ rycee ];
license = licenses.gpl3Plus;
};
}