python313Packages.pypdfium2: 4.30.1 -> 5.0.0 (#436330)
This commit is contained in:
@@ -8,8 +8,7 @@
|
|||||||
|
|
||||||
stdenv.mkDerivation (finalAttrs: {
|
stdenv.mkDerivation (finalAttrs: {
|
||||||
pname = "pdfium-binaries";
|
pname = "pdfium-binaries";
|
||||||
# also update rev of headers in python3Packages.pypdfium2
|
version = "7363";
|
||||||
version = "7087";
|
|
||||||
|
|
||||||
src =
|
src =
|
||||||
let
|
let
|
||||||
@@ -28,17 +27,17 @@ stdenv.mkDerivation (finalAttrs: {
|
|||||||
hash =
|
hash =
|
||||||
if withV8 then
|
if withV8 then
|
||||||
selectSystem {
|
selectSystem {
|
||||||
x86_64-linux = "sha256-nKHXcBTEp165g18HLzaNGfKt8MtTYpKBGNgwIpSO0u4=";
|
x86_64-linux = "sha256-KbAJUdbT3XjLs68y4xwEG5w8o/89epkXSCKpQsyuNec=";
|
||||||
aarch64-linux = "sha256-wip/ry42aDbyGiwYSUX8koxDuf88BLGZAmMZE0s+fL0=";
|
aarch64-linux = "sha256-zvaTKszH5yT1afzs0W3LV1caN6gaCIJiKIh9bElfI48=";
|
||||||
x86_64-darwin = "sha256-7pUMfNFgGqQ8Dnox57sHfrKKke+i8CGEma4tePJaTDA=";
|
x86_64-darwin = "sha256-xGnmndTkYSIGn44Y4cfYW36QmkVAOhgIlcsWaRYFbCk=";
|
||||||
aarch64-darwin = "sha256-o59kmTNC4nSCFLfww3E+4iIYs2kQ30yyFaX9f2Za7os=";
|
aarch64-darwin = "sha256-NYY/YIVtSux4B6UZb7kkZs+GzxXNopmvtknw/HhVEQs=";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
selectSystem {
|
selectSystem {
|
||||||
x86_64-linux = "sha256-zn7QlTvChQa2mQCe5K+zEGVUtuD+l/jEtlKticrrSKg=";
|
x86_64-linux = "sha256-mlSmVeE1oDQ1OlW8K7EXk51r7GCbDXH2l/tbat2aiB0=";
|
||||||
aarch64-linux = "sha256-080X72NNfKaanHeVtmxE/4uNV6Ue4f/1Mri/p3nOT8c=";
|
aarch64-linux = "sha256-YiCMdwQ2Y0F120iKW3ZkxJKvDgP/vpPw1ItmRnsnz9U=";
|
||||||
x86_64-darwin = "sha256-XMStU0MN9ieCrLQnQL4/jKrNWxgQl9OtZHg9EmemPhU=";
|
x86_64-darwin = "sha256-I2fWQC+GKzZwqTPwXkl9vDJ/HIH3GKzD+kNaUDcNKuw=";
|
||||||
aarch64-darwin = "sha256-Q8R/p1hX6+JeVTFc6w7MC9GPNGqxlu6m+iawRIMndic=";
|
aarch64-darwin = "sha256-AhYAr5SySWJO3jbvs+DvEZ/WaCJ+KhxpFVyOVsJxuXE=";
|
||||||
};
|
};
|
||||||
stripRoot = false;
|
stripRoot = false;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
{
|
{
|
||||||
stdenv,
|
stdenv,
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
pkgsCross,
|
||||||
buildPythonPackage,
|
buildPythonPackage,
|
||||||
fetchFromGitHub,
|
fetchFromGitHub,
|
||||||
fetchgit,
|
|
||||||
gitUpdater,
|
gitUpdater,
|
||||||
setuptools-scm,
|
setuptools-scm,
|
||||||
pdfium-binaries,
|
pdfium-binaries,
|
||||||
@@ -13,22 +12,9 @@
|
|||||||
pytestCheckHook,
|
pytestCheckHook,
|
||||||
removeReferencesTo,
|
removeReferencesTo,
|
||||||
python,
|
python,
|
||||||
replaceVars,
|
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
pdfiumVersion = "${pdfium-binaries.version}";
|
|
||||||
|
|
||||||
headers = fetchgit {
|
|
||||||
url = "https://pdfium.googlesource.com/pdfium";
|
|
||||||
# The latest revision on the chromium/${pdfiumVersion} branch
|
|
||||||
rev = "9232d7c94a0007377a8034222f47683fe391d474";
|
|
||||||
hash = "sha256-dI3jTyVYc0EmMLHTiVjGSf3C2noS9Ru5WijEJFtiSFk=";
|
|
||||||
sparseCheckout = [
|
|
||||||
"public"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
# They demand their own fork of ctypesgen
|
# They demand their own fork of ctypesgen
|
||||||
ctypesgen = buildPythonPackage rec {
|
ctypesgen = buildPythonPackage rec {
|
||||||
pname = "ctypesgen";
|
pname = "ctypesgen";
|
||||||
@@ -38,34 +24,26 @@ let
|
|||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "pypdfium2-team";
|
owner = "pypdfium2-team";
|
||||||
repo = "ctypesgen";
|
repo = "ctypesgen";
|
||||||
rev = "848e9fbb1374f7f58a7ebf5e5da5c33292480b30";
|
rev = "3961621c3e057015362db82471e07f3a57822b15";
|
||||||
hash = "sha256-3JA7cW/xaEj/DxMHEypROwrKGo7EwUEcipRqALTvydw=";
|
hash = "sha256-0OBY7/Zn12rG20jNYG65lANTRVRIFvE0SgUdYGFpRtU=";
|
||||||
};
|
};
|
||||||
|
|
||||||
patches = [
|
|
||||||
(replaceVars ./fix-cc-detection.patch {
|
|
||||||
cc = "${stdenv.cc.targetPrefix}cc";
|
|
||||||
})
|
|
||||||
];
|
|
||||||
|
|
||||||
build-system = [
|
build-system = [
|
||||||
setuptools-scm
|
setuptools-scm
|
||||||
];
|
];
|
||||||
|
|
||||||
env.SETUPTOOLS_SCM_PRETEND_VERSION = "${version}";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
in
|
in
|
||||||
buildPythonPackage rec {
|
buildPythonPackage rec {
|
||||||
pname = "pypdfium2";
|
pname = "pypdfium2";
|
||||||
version = "4.30.1";
|
version = "5.0.0";
|
||||||
pyproject = true;
|
pyproject = true;
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "pypdfium2-team";
|
owner = "pypdfium2-team";
|
||||||
repo = "pypdfium2";
|
repo = "pypdfium2";
|
||||||
tag = version;
|
tag = version;
|
||||||
hash = "sha256-v8f/XruGJYK3H9z4Q1rLg4fEnPHa8tTOlNTBMVxPEgA=";
|
hash = "sha256-to6l8kfi6pYRs+hv+9zdxpSyhKCxX79G/EMdz6OBBaA=";
|
||||||
};
|
};
|
||||||
|
|
||||||
build-system = [
|
build-system = [
|
||||||
@@ -81,43 +59,19 @@ buildPythonPackage rec {
|
|||||||
pdfium-binaries
|
pdfium-binaries
|
||||||
];
|
];
|
||||||
|
|
||||||
# Build system insists on fetching from the internet unless "cached" files
|
preBuild = ''
|
||||||
# are prepared. Even then, some code patching needs to happen to make it not
|
getVersion() {
|
||||||
# talk to the internet.
|
cat ${pdfium-binaries}/VERSION | grep $1 | sed 's/.*=//'
|
||||||
|
}
|
||||||
|
export GIVEN_FULLVER="$(getVersion MAJOR).$(getVersion MINOR).$(getVersion BUILD).$(getVersion PATCH)"
|
||||||
|
'';
|
||||||
|
|
||||||
# The project doesn't seem very open to allow for offline building either,
|
env = {
|
||||||
# see: https://github.com/pypdfium2-team/pypdfium2/discussions/274
|
PDFIUM_PLATFORM = "system-search:${pdfium-binaries.version}";
|
||||||
preBuild =
|
PDFIUM_HEADERS = "${pdfium-binaries}/include";
|
||||||
let
|
PDFIUM_BINARY = "${pdfium-binaries}/lib/libpdfium${stdenv.targetPlatform.extensions.sharedLibrary}";
|
||||||
pdfiumLib = lib.makeLibraryPath [ pdfium-binaries ];
|
CPP = "${stdenv.cc.targetPrefix}cpp";
|
||||||
inputVersionFile = (pkgs.formats.json { }).generate "version.json" {
|
};
|
||||||
version = lib.strings.toInt pdfiumVersion;
|
|
||||||
source = "generated";
|
|
||||||
flags = [ ];
|
|
||||||
run_lds = [ pdfiumLib ];
|
|
||||||
guard_symbols = false;
|
|
||||||
};
|
|
||||||
bindingsDir = "data/bindings";
|
|
||||||
headersDir = "${bindingsDir}/headers";
|
|
||||||
versionFile = "${bindingsDir}/version.json";
|
|
||||||
in
|
|
||||||
''
|
|
||||||
# Preseed the headers and version file
|
|
||||||
mkdir -p ${bindingsDir}
|
|
||||||
cp -r ${headers}/public ${headersDir}
|
|
||||||
install -m 644 ${inputVersionFile} ${versionFile}
|
|
||||||
|
|
||||||
# Make generated bindings consider pdfium derivation path when loading dynamic libraries
|
|
||||||
substituteInPlace setupsrc/pypdfium2_setup/emplace.py \
|
|
||||||
--replace-fail 'build_pdfium_bindings(pdfium_ver, flags=flags, guard_symbols=True, run_lds=[])' \
|
|
||||||
'build_pdfium_bindings(pdfium_ver, flags=flags, guard_symbols=True, run_lds=["${pdfiumLib}"])'
|
|
||||||
|
|
||||||
# Short circuit the version pull from the internet
|
|
||||||
substituteInPlace setupsrc/pypdfium2_setup/packaging_base.py \
|
|
||||||
--replace-fail 'PdfiumVer.to_full(build)._asdict()' \
|
|
||||||
'{"major": 133, "minor": 0, "build": ${pdfiumVersion}, "patch": 1}'
|
|
||||||
'';
|
|
||||||
env.PDFIUM_PLATFORM = "system:${pdfiumVersion}";
|
|
||||||
|
|
||||||
# Remove references to stdenv in comments.
|
# Remove references to stdenv in comments.
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
@@ -138,6 +92,7 @@ buildPythonPackage rec {
|
|||||||
updateScript = gitUpdater {
|
updateScript = gitUpdater {
|
||||||
allowedVersions = "^[.0-9]+$";
|
allowedVersions = "^[.0-9]+$";
|
||||||
};
|
};
|
||||||
|
tests.cross = pkgsCross.aarch64-multiplatform.python3Packages.pypdfium2;
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
diff --git a/src/ctypesgen/__main__.py b/src/ctypesgen/__main__.py
|
|
||||||
index 23ee014..2d0cfc1 100644
|
|
||||||
--- a/src/ctypesgen/__main__.py
|
|
||||||
+++ b/src/ctypesgen/__main__.py
|
|
||||||
@@ -89,17 +89,9 @@ def main_impl(args, cmd_str):
|
|
||||||
assert _is_relative_to(args.output, args.linkage_anchor)
|
|
||||||
|
|
||||||
if args.cpp:
|
|
||||||
- assert shutil.which(args.cpp[0]), f"Given pre-processor {args.cpp[0]!r} is not available."
|
|
||||||
- else:
|
|
||||||
- if shutil.which("gcc"):
|
|
||||||
- args.cpp = ["gcc", "-E"]
|
|
||||||
- elif shutil.which("cpp"):
|
|
||||||
- args.cpp = ["cpp"]
|
|
||||||
- elif shutil.which("clang"):
|
|
||||||
- args.cpp = ["clang", "-E"]
|
|
||||||
- else:
|
|
||||||
- raise RuntimeError("C pre-processor auto-detection failed: neither gcc nor clang available.")
|
|
||||||
-
|
|
||||||
+ print("cpp argument ignored for nix build")
|
|
||||||
+ args.cpp = ["@cc@", "-E"]
|
|
||||||
+
|
|
||||||
# Important: must not use +=, this would mutate the original object, which is problematic when default=[] is used and ctypesgen called repeatedly from within python
|
|
||||||
args.compile_libdirs = args.compile_libdirs + args.universal_libdirs
|
|
||||||
args.runtime_libdirs = args.runtime_libdirs + args.universal_libdirs
|
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
lib,
|
lib,
|
||||||
buildPythonPackage,
|
buildPythonPackage,
|
||||||
fetchFromGitHub,
|
fetchFromGitHub,
|
||||||
|
fetchpatch,
|
||||||
setuptools,
|
setuptools,
|
||||||
setuptools-scm,
|
setuptools-scm,
|
||||||
pillow,
|
pillow,
|
||||||
@@ -22,6 +23,14 @@ buildPythonPackage rec {
|
|||||||
hash = "sha256-B8jrFQh5swDMfYjdMcY0Hh2VAzknDwarDKVAML6F2r4=";
|
hash = "sha256-B8jrFQh5swDMfYjdMcY0Hh2VAzknDwarDKVAML6F2r4=";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
patches = [
|
||||||
|
# fix compatibility with pypdfium2 5.x: https://github.com/miikanissi/zebrafy/pull/20
|
||||||
|
(fetchpatch {
|
||||||
|
url = "https://github.com/miikanissi/zebrafy/pull/20/commits/cc15c4a28d9e8aec022d22397ff752600b9ede52.patch";
|
||||||
|
hash = "sha256-KAjfKPqmTvfoQN7YPLayPyq2sueDASyU/lMCgLCl1RU=";
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
build-system = [
|
build-system = [
|
||||||
setuptools
|
setuptools
|
||||||
setuptools-scm
|
setuptools-scm
|
||||||
|
|||||||
Reference in New Issue
Block a user