Commit 6a5c04d1 authored by Gaetan Lepage's avatar Gaetan Lepage
Browse files

python3Packages.swh-objstorage: cleanup, fix on python>=3.14

parent 02dc6832
Loading
Loading
Loading
Loading
+31 −13
Original line number Diff line number Diff line
@@ -3,8 +3,14 @@
  stdenv,
  buildPythonPackage,
  fetchFromGitLab,
  pythonAtLeast,
  util-linux,

  # build-system
  setuptools,
  setuptools-scm,

  # dependencies
  backports-entry-points-selectable,
  cassandra-driver,
  click,
@@ -15,10 +21,12 @@
  mypy-extensions,
  psycopg,
  redis,
  tenacity,
  swh-core,
  swh-model,
  swh-shard,
  tenacity,

  # tests
  aiohttp,
  azure-core,
  azure-storage-blob,
@@ -26,16 +34,15 @@
  libcloud,
  postgresql,
  postgresqlTestHook,
  pytestCheckHook,
  pytest-mock,
  pytest-postgresql,
  pytestCheckHook,
  requests-mock,
  requests-toolbelt,
  systemd-python,
  types-python-dateutil,
  types-pyyaml,
  types-requests,
  util-linux,
}:

buildPythonPackage (finalAttrs: {
@@ -52,6 +59,13 @@ buildPythonPackage (finalAttrs: {
    hash = "sha256-NnNT9Lt/LGDIJpUmfkfPn6JnF3k8Usf2UVa88zHPKlg=";
  };

  postPatch = ''
    substituteInPlace swh/objstorage/backends/winery/roshard.py \
      --replace-fail \
        "/usr/bin/fallocate" \
        "${lib.getExe' util-linux "fallocate"}"
  '';

  build-system = [
    setuptools
    setuptools-scm
@@ -68,17 +82,12 @@ buildPythonPackage (finalAttrs: {
    mypy-extensions
    psycopg
    redis
    tenacity
    swh-core
    swh-model
    swh-shard
    tenacity
  ];

  preCheck = ''
    substituteInPlace swh/objstorage/backends/winery/roshard.py \
      --replace-fail "/usr/bin/fallocate" "fallocate"
  '';

  pythonImportsCheck = [ "swh.objstorage" ];

  # Many broken tests on Darwin. Disabling them for now.
@@ -94,9 +103,9 @@ buildPythonPackage (finalAttrs: {
    libcloud
    postgresql
    postgresqlTestHook
    pytestCheckHook
    pytest-mock
    pytest-postgresql
    pytestCheckHook
    requests-mock
    requests-toolbelt
    systemd-python
@@ -107,7 +116,16 @@ buildPythonPackage (finalAttrs: {
  ]
  ++ psycopg.optional-dependencies.pool;

  disabledTests = lib.optionals (stdenv.hostPlatform.isAarch64 && stdenv.hostPlatform.isLinux) [
  disabledTestPaths = lib.optionals (pythonAtLeast "3.14") [
    # _pickle.PicklingError: Can't pickle local object
    "swh/objstorage/tests/test_objstorage_api.py"
  ];

  disabledTests =
    lib.optionals (pythonAtLeast "3.14") [
      "test_winery_add_and_pack"
    ]
    ++ lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) [
      # FAILED swh/objstorage/tests/test_objstorage_winery.py::test_winery_leaky_bucket_tick - assert 1 == 0
      "test_winery_leaky_bucket_tick"
    ];