Unverified Commit 3a9f2af3 authored by Donovan Glover's avatar Donovan Glover Committed by GitHub
Browse files

python312Packages.rapidocr-onnxruntime: 1.3.24 -> 1.4.1 (#362580)

parents ace01cb5 ff32f66b
Loading
Loading
Loading
Loading
+28 −20
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  buildPythonPackage,
  fetchFromGitHub,

  fetchzip,
  substitute,
  pytestCheckHook,
  replaceVars,

  setuptools,
  pyclipper,
@@ -17,22 +15,28 @@
  pyyaml,
  pillow,
  onnxruntime,
  tqdm,

  pytestCheckHook,
  requests,
}:
let
  version = "1.3.24";
  version = "1.4.1";

  src = fetchFromGitHub {
    owner = "RapidAI";
    repo = "RapidOCR";
    rev = "refs/tags/v${version}";
    hash = "sha256-+iY+/IdOgsn+LPZQ4Kdzxuh31csQ7dyh5Zf552ne3N0=";
    tag = "v${version}";
    hash = "sha256-6ohh4NSYqJ+i1JRdsKbcJZns07c+roVJ87r0lvBbExU=";
  };

  models = fetchzip {
  models =
    fetchzip {
      url = "https://github.com/RapidAI/RapidOCR/releases/download/v1.1.0/required_for_whl_v1.3.0.zip";
      hash = "sha256-j/0nzyvu/HfNTt5EZ+2Phe5dkyPOdQw/OZTz0yS63aA=";
      stripRoot = false;
  } + "/required_for_whl_v1.3.0/resources/models";
    }
    + "/required_for_whl_v1.3.0/resources/models";
in
buildPythonPackage {
  pname = "rapidocr-onnxruntime";
@@ -52,13 +56,8 @@ buildPythonPackage {
  # This is not allowed in the Nix build environment as we do not have internet access,
  # hence we patch that out and get the version from the build environment directly.
  patches = [
    (substitute {
      src = ./setup-py-override-version-checking.patch;
      substitutions = [
        "--subst-var-by"
        "version"
        version
      ];
    (replaceVars ./setup-py-override-version-checking.patch {
      inherit version;
    })
  ];

@@ -97,11 +96,15 @@ buildPythonPackage {
    pyyaml
    pillow
    onnxruntime
    tqdm
  ];

  pythonImportsCheck = [ "rapidocr_onnxruntime" ];

  nativeCheckInputs = [ pytestCheckHook ];
  nativeCheckInputs = [
    pytestCheckHook
    requests
  ];

  # These are tests for different backends.
  disabledTestPaths = [
@@ -109,10 +112,15 @@ buildPythonPackage {
    "tests/test_paddle.py"
  ];

  disabledTests = [
    # Needs Internet access
    "test_long_img"
  ];

  meta = {
    # This seems to be related to https://github.com/microsoft/onnxruntime/issues/10038
    # Also some related issue: https://github.com/NixOS/nixpkgs/pull/319053#issuecomment-2167713362
    broken = (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64);
    badPlatforms = [ "aarch64-linux" ];
    changelog = "https://github.com/RapidAI/RapidOCR/releases/tag/v${version}";
    description = "Cross platform OCR Library based on OnnxRuntime";
    homepage = "https://github.com/RapidAI/RapidOCR";