Unverified Commit 50b30f81 authored by kirillrdy's avatar kirillrdy Committed by GitHub
Browse files

python3Packages.nibabel: cleanup, fix on darwin (#480291)

parents 79ccb839 bca3dcb3
Loading
Loading
Loading
Loading
+17 −12
Original line number Diff line number Diff line
@@ -5,17 +5,25 @@
  fetchpatch2,
  pythonAtLeast,
  pythonOlder,
  hatchling,

  # build-system
  hatch-vcs,
  hatchling,

  # dependencies
  numpy,
  packaging,
  importlib-resources,
  typing-extensions,

  # optional-dependencies
  pydicom,
  pillow,
  h5py,
  scipy,
  git,

  addBinToPathHook,
  gitMinimal,
  pytest-doctestplus,
  pytest-httpserver,
  pytest-xdist,
@@ -42,8 +50,8 @@ buildPythonPackage (finalAttrs: {
  ];

  build-system = [
    hatchling
    hatch-vcs
    hatchling
  ];

  dependencies = [
@@ -53,19 +61,20 @@ buildPythonPackage (finalAttrs: {
  ++ lib.optionals (pythonOlder "3.12") [ importlib-resources ]
  ++ lib.optionals (pythonOlder "3.13") [ typing-extensions ];

  optional-dependencies = rec {
    all = dicom ++ dicomfs ++ minc2 ++ spm ++ zstd;
  optional-dependencies = lib.fix (self: {
    all = self.dicom ++ self.dicomfs ++ self.minc2 ++ self.spm ++ self.zstd;
    dicom = [ pydicom ];
    dicomfs = [ pillow ] ++ dicom;
    dicomfs = [ pillow ] ++ self.dicom;
    minc2 = [ h5py ];
    spm = [ scipy ];
    zstd = [
      # TODO: pyzstd
    ];
  };
  });

  nativeCheckInputs = [
    git
    addBinToPathHook
    gitMinimal
    pytest-doctestplus
    pytest-httpserver
    pytest-xdist
@@ -78,10 +87,6 @@ buildPythonPackage (finalAttrs: {
    "test_deprecator_maker"
  ];

  preCheck = ''
    export PATH=$out/bin:$PATH
  '';

  meta = {
    homepage = "https://nipy.org/nibabel";
    changelog = "https://github.com/nipy/nibabel/blob/${finalAttrs.version}/Changelog";
+5 −13
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ let
    hash = "sha256-ji7SppKdiszaXs8yCSIPkJj4Ld++XWNw9FuxLoFLfFo=";
  };
in
buildPythonPackage rec {
buildPythonPackage (finalAttrs: {
  pname = "pydicom";
  version = "3.0.1";
  pyproject = true;
@@ -34,7 +34,7 @@ buildPythonPackage rec {
  src = fetchFromGitHub {
    owner = "pydicom";
    repo = "pydicom";
    tag = "v${version}";
    tag = "v${finalAttrs.version}";
    hash = "sha256-SvRevQehRaSp+vCtJRQVEJiC5noIJS+bGG1/q4p7/XU=";
  };

@@ -60,7 +60,7 @@ buildPythonPackage rec {
    pytestCheckHook
    writableTmpDirAsHomeHook
  ]
  ++ optional-dependencies.pixeldata;
  ++ finalAttrs.passthru.optional-dependencies.pixeldata;

  passthru.pydicom-data = test_data;

@@ -105,16 +105,8 @@ buildPythonPackage rec {
    description = "Python package for working with DICOM files";
    mainProgram = "pydicom";
    homepage = "https://pydicom.github.io";
    changelog = "https://github.com/pydicom/pydicom/releases/tag/v${version}";
    changelog = "https://github.com/pydicom/pydicom/releases/tag/${finalAttrs.src.tag}";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ bcdarwin ];
    badPlatforms = [
      # > 200 tests are failing with errors like:
      # AttributeError: 'FileDataset' object has no attribute 'BitsStored'
      # AttributeError: 'FileDataset' object has no attribute 'Rows'
      # AttributeError: The dataset has no 'Pixel Data', 'Float Pixel Data' or 'Double Float Pixel Data' element, no pixel data to decode
      # pydicom.errors.InvalidDicomError: File is missing DICOM File Meta Information header or the 'DICM' prefix is missing from the header.
      lib.systems.inspect.patterns.isDarwin
    ];
  };
}
})