hyperscan: cleanup, fix build; babeldoc: cleanup, fix (#549055)

This commit is contained in:
Yt
2026-08-04 10:30:39 +00:00
committed by GitHub
3 changed files with 45 additions and 43 deletions
+28 -34
View File
@@ -1,83 +1,77 @@
{
lib,
python3Packages,
python313Packages,
fetchFromGitHub,
fetchpatch2,
writableTmpDirAsHomeHook,
versionCheckHook,
}:
let
python3Packages = python313Packages;
in
python3Packages.buildPythonApplication (finalAttrs: {
pname = "babeldoc";
version = "0.5.22";
version = "0.6.4";
pyproject = true;
__structuredAttrs = true;
src = fetchFromGitHub {
owner = "funstory-ai";
repo = "BabelDOC";
tag = "v${finalAttrs.version}";
hash = "sha256-ArLTv5AjpUdbsN8bQs03ATwg5ugXetld2FmHhicU8OE=";
hash = "sha256-eYCIXMYOJPGReDFkFdxgrhpkAG/pA14v3Si+5unfXz4=";
};
patches = [
(fetchpatch2 {
name = "rename-python-levenshtein-to-levenshtein";
url = "https://github.com/funstory-ai/BabelDOC/pull/542.patch?full_index=1";
hash = "sha256-rjXhKVFivkJo54WdYiihqB3lrlu4YEwVZZkE4WBatWs=";
})
build-system = with python3Packages; [
hatchling
];
build-system = with python3Packages; [ hatchling ];
dependencies =
with python3Packages;
[
bitstring
chardet
charset-normalizer
configargparse
cryptography
freetype-py
httpx
huggingface-hub
hyperscan
levenshtein
msgpack
numpy
onnx
onnxruntime
openai
opencv-python-headless
orjson
charset-normalizer
cryptography
peewee
psutil
pydantic
pymupdf
pyzstd
rapidocr-onnxruntime
rich
rtree
scikit-image
scikit-learn
scipy
tenacity
tiktoken
toml
tqdm
xsdata
msgpack
pydantic
tenacity
scikit-image
freetype-py
tiktoken
levenshtein
opencv-python-headless
rapidocr-onnxruntime
pyzstd
hyperscan
rtree
chardet
scipy
uharfbuzz
scikit-learn
xsdata
]
++ httpx.optional-dependencies.socks
++ (with xsdata.optional-dependencies; cli ++ lxml ++ soap);
pythonImportsCheck = [ "babeldoc" ];
# Upstream dropped its test suite in 0.6.0
nativeCheckInputs = [
writableTmpDirAsHomeHook
python3Packages.pytestCheckHook
versionCheckHook
];
versionCheckKeepEnvironment = "HOME";
meta = {
description = "PDF scientific paper translation and bilingual comparison library";
+6 -2
View File
@@ -8,7 +8,7 @@
util-linux,
pkg-config,
boost,
pcre2,
pcre,
withStatic ? false, # build only shared libs by default, build static+shared if true
}:
@@ -16,6 +16,9 @@ stdenv.mkDerivation (finalAttrs: {
pname = "hyperscan";
version = "5.4.2";
__structuredAttrs = true;
strictDeps = true;
src = fetchFromGitHub {
owner = "intel";
repo = "hyperscan";
@@ -75,10 +78,11 @@ stdenv.mkDerivation (finalAttrs: {
# hyperscan CMake is completely broken for chimera builds when pcre is compiled
# the only option to make it build - building from source
# In case pcre is built from source, chimera build is turned on by default
# NOTE: chimera requires PCRE1 (>= 8.41), it is not compatible with pcre2.
preConfigure = lib.optionalString withStatic (
''
mkdir -p pcre
tar xvf ${pcre2.src} --strip-components 1 -C pcre
tar xvf ${pcre.src} --strip-components 1 -C pcre
''
# - CMake 4 dropped support of versions lower than 3.5, versions lower than 3.10 are deprecated.
# https://github.com/NixOS/nixpkgs/issues/445447
@@ -21,19 +21,23 @@ let
];
};
in
buildPythonPackage rec {
buildPythonPackage (finalAttrs: {
pname = "hyperscan";
version = "0.8.0";
version = "0.8.2";
pyproject = true;
__structuredAttrs = true;
src = fetchFromGitHub {
owner = "darvid";
repo = "python-hyperscan";
tag = "v${version}";
hash = "sha256-on++eSNaVY2Q6yT/O+unvE0x/Pt/SsIQFQblIqii2sM=";
tag = "v${finalAttrs.version}";
hash = "sha256-jIDUfl6ReWvypfWecM8hReux6YxzXSsLCFU3AO97xUY=";
};
env.CMAKE_ARGS = "-DHS_SRC_ROOT=${pkgs.hyperscan.src} -DHS_BUILD_LIB_ROOT=${lib-deps}/lib";
env.CMAKE_ARGS = lib.toString [
(lib.cmakeFeature "HS_SRC_ROOT" pkgs.hyperscan.src.outPath)
(lib.cmakeFeature "HS_BUILD_LIB_ROOT" "${lib-deps}/lib")
];
dontUseCmakeConfigure = true;
@@ -56,11 +60,11 @@ buildPythonPackage rec {
meta = {
description = "CPython extension for the Hyperscan regular expression matching library";
homepage = "https://github.com/darvid/python-hyperscan";
changelog = "https://github.com/darvid/python-hyperscan/blob/${src.tag}/CHANGELOG.md";
changelog = "https://github.com/darvid/python-hyperscan/blob/${finalAttrs.src.tag}/CHANGELOG.md";
platforms = [
"x86_64-linux"
];
license = lib.licenses.mit;
maintainers = [ ];
};
}
})