Commit 581106f2 authored by Gaetan Lepage's avatar Gaetan Lepage
Browse files

python312Packages.collections-extended: fix for python>=3.11

parent d325772e
Loading
Loading
Loading
Loading
+16 −12
Original line number Diff line number Diff line
@@ -5,26 +5,29 @@
  hypothesis,
  poetry-core,
  pytestCheckHook,
  pythonOlder,
  pythonAtLeast,
}:

buildPythonPackage rec {
  pname = "collections-extended";
  version = "2.0.2";
  format = "pyproject";

  # https://github.com/mlenzen/collections-extended/issues/198
  disabled = pythonOlder "3.6" || pythonAtLeast "3.11";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "mlenzen";
    repo = pname;
    rev = "v${version}";
    repo = "collections-extended";
    tag = "v${version}";
    hash = "sha256-cK13+CQUELKSiLpG747+C+RB5b6luu0mWLLXTT+uGH4=";
  };

  nativeBuildInputs = [ poetry-core ];
  # shuffle's random option has been removed in python 3.11
  postPatch = ''
    substituteInPlace collections_extended/setlists.py \
      --replace-fail \
        "random_.shuffle(self._list, random=random)" \
        "random_.shuffle(self._list)"
  '';

  build-system = [ poetry-core ];

  nativeCheckInputs = [
    hypothesis
@@ -33,10 +36,11 @@ buildPythonPackage rec {

  pythonImportsCheck = [ "collections_extended" ];

  meta = with lib; {
  meta = {
    description = "Extra Python Collections - bags (multisets), setlists (unique list/indexed set), RangeMap and IndexedDict";
    homepage = "https://github.com/mlenzen/collections-extended";
    license = licenses.asl20;
    maintainers = with maintainers; [ exarkun ];
    changelog = "https://github.com/mlenzen/collections-extended/releases/tag/v${version}";
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [ exarkun ];
  };
}