nixpkgs-suyu/pkgs/development/python-modules/pydicom/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

60 lines
1.5 KiB
Nix

{ lib, stdenv
, buildPythonPackage
, fetchFromGitHub
, isPy27
, pytestrunner
, pytestCheckHook
, numpy
, pillow
}:
let
pname = "pydicom";
version = "2.1.2";
src = fetchFromGitHub {
owner = "${pname}";
repo = "${pname}";
rev = "v${version}";
sha256 = "sha256-iExy+mUs1uqs/u9N6btlqyP6/TvoPVsuOuzs56zZAS8=";
};
# Pydicom needs pydicom-data to run some tests. If these files are downloaded
# before the package creation, it'll try to download during the checkPhase.
test_data = fetchFromGitHub {
owner = "${pname}";
repo = "${pname}-data";
rev = "bbb723879690bb77e077a6d57657930998e92bd5";
sha256 = "sha256-dCI1temvpNWiWJYVfQZKy/YJ4ad5B0e9hEKHJnEeqzk=";
};
in
buildPythonPackage {
inherit pname version src;
disabled = isPy27;
propagatedBuildInputs = [ numpy pillow ];
checkInputs = [ pytestrunner pytestCheckHook ];
# Setting $HOME to prevent pytest to try to create a folder inside
# /homeless-shelter which is read-only.
# Linking pydicom-data dicom files to $HOME/.pydicom/data
preCheck = ''
export HOME=$TMP/test-home
mkdir -p $HOME/.pydicom/
ln -s ${test_data}/data_store/data $HOME/.pydicom/data
'';
# This test try to remove a dicom inside $HOME/.pydicom/data/ and download it again.
disabledTests = [
"test_fetch_data_files"
];
meta = with lib; {
homepage = "https://pydicom.github.io";
description = "Pure-Python package for working with DICOM files";
license = licenses.mit;
maintainers = with maintainers; [ bcdarwin ];
};
}