Skip to content

Commit 4c4c362

Browse files
committed
[autorelease main] update 4.27.0
1 parent 2d165af commit 4c4c362

File tree

4 files changed

+47
-75
lines changed

4 files changed

+47
-75
lines changed

autorelease/bindings.py

+38-71
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,20 @@
11
R"""
22
Auto-generated by:
3-
ctypesgen --library pdfium --no-macro-guards --runtime-libdirs . --no-load-library -D PDF_ENABLE_V8 PDF_ENABLE_XFA PDF_USE_SKIA --symbol-rules if_needed=\w+_$|\w+_t$|_\w+ --headers fpdf_annot.h fpdf_attachment.h fpdf_catalog.h fpdf_dataavail.h fpdf_doc.h fpdf_edit.h fpdf_ext.h fpdf_flatten.h fpdf_formfill.h fpdf_fwlevent.h fpdf_javascript.h fpdf_ppo.h fpdf_progressive.h fpdf_save.h fpdf_searchex.h fpdf_signature.h fpdf_structtree.h fpdf_sysfontinfo.h fpdf_text.h fpdf_thumbnail.h fpdf_transformpage.h fpdfview.h -o ./data/bindings/bindings.py
3+
ctypesgen -l pdfium --runtime-libdirs . --no-load-library --no-macro-guards -D PDF_ENABLE_V8 PDF_ENABLE_XFA PDF_USE_SKIA --symbol-rules 'if_needed=\w+_$|\w+_t$|_\w+' --headers fpdf_annot.h fpdf_attachment.h fpdf_catalog.h fpdf_dataavail.h fpdf_doc.h fpdf_edit.h fpdf_ext.h fpdf_flatten.h fpdf_formfill.h fpdf_fwlevent.h fpdf_javascript.h fpdf_ppo.h fpdf_progressive.h fpdf_save.h fpdf_searchex.h fpdf_signature.h fpdf_structtree.h fpdf_sysfontinfo.h fpdf_text.h fpdf_thumbnail.h fpdf_transformpage.h fpdfview.h -o ./data/bindings/bindings.py
44
"""
55

6-
# -- Begin preamble --
7-
8-
# TODO
9-
# - add c_ptrdiff_t only on as-needed basis
10-
# - Avoid ctypes glob import (pollutes namespace)
11-
126
import ctypes
13-
from ctypes import * # noqa: F401, F403
14-
15-
def _get_ptrdiff_t():
16-
17-
int_types = (ctypes.c_int16, ctypes.c_int32)
18-
if hasattr(ctypes, "c_int64"):
19-
# Some builds of ctypes apparently do not have ctypes.c_int64
20-
# defined; it's a pretty good bet that these builds do not
21-
# have 64-bit pointers.
22-
int_types += (ctypes.c_int64,)
23-
24-
c_ptrdiff_t = None
25-
for t in int_types:
26-
if ctypes.sizeof(t) == ctypes.sizeof(ctypes.c_size_t):
27-
c_ptrdiff_t = t
28-
29-
return c_ptrdiff_t
30-
31-
c_ptrdiff_t = _get_ptrdiff_t()
32-
33-
# -- End preamble --
7+
from ctypes import *
348

359

3610
# -- Begin loader template --
3711

3812
import sys
3913
import ctypes
4014
import ctypes.util
41-
import warnings
4215
import pathlib
4316

44-
def _find_library(name, dirs, search_sys, reldir=None):
17+
def _find_library(name, dirs, search_sys):
4518

4619
if sys.platform in ("win32", "cygwin", "msys"):
4720
patterns = ["{}.dll", "lib{}.dll", "{}"]
@@ -50,39 +23,27 @@ def _find_library(name, dirs, search_sys, reldir=None):
5023
else: # assume unix pattern or plain name
5124
patterns = ["lib{}.so", "{}.so", "{}"]
5225

53-
if reldir is None:
54-
try:
55-
reldir = pathlib.Path(__file__).parent
56-
except NameError:
57-
reldir = None
58-
5926
for dir in dirs:
6027
dir = pathlib.Path(dir)
6128
if not dir.is_absolute():
6229
# NOTE joining an absolute path silently discardy the path before
63-
assert reldir != None, "cannot resolve relative paths without anchor point (__file__ not defined?)"
64-
dir = (reldir/dir).resolve(strict=False)
30+
dir = (pathlib.Path(__file__).parent / dir).resolve(strict=False)
6531
for pat in patterns:
6632
libpath = dir / pat.format(name)
6733
if libpath.is_file():
6834
return str(libpath)
6935

70-
if search_sys:
71-
if dirs:
72-
warnings.warn(f"Could not find library '{name}' in {dirs}, falling back to system")
73-
libpath = ctypes.util.find_library(name)
74-
if not libpath:
75-
raise ImportError(f"Could not find library '{name}' in system")
76-
return libpath
77-
else:
78-
raise ImportError(f"Could not find library '{name}' in {dirs} (system search disabled)")
36+
libpath = ctypes.util.find_library(name) if search_sys else None
37+
if not libpath:
38+
raise ImportError(f"Could not find library '{name}' (dirs={dirs}, search_sys={search_sys})")
39+
40+
return libpath
7941

8042
_libs_info, _libs = {}, {}
8143

8244
def _register_library(name, dllclass, **kwargs):
8345
libpath = _find_library(name, **kwargs)
84-
assert libpath, "output expected from _find_library()"
85-
_libs_info[name] = {"name": name, "dllclass": dllclass, **kwargs, "path": libpath}
46+
_libs_info[name] = {**kwargs, "path": libpath}
8647
_libs[name] = dllclass(libpath)
8748

8849
# -- End loader template --
@@ -2481,133 +2442,139 @@ class struct_FPDF_IMAGEOBJ_METADATA (Structure):
24812442
FPDFText_LoadStandardFont.argtypes = [FPDF_DOCUMENT, FPDF_BYTESTRING]
24822443
FPDFText_LoadStandardFont.restype = FPDF_FONT
24832444

2484-
# ./data/bindings/headers/fpdf_edit.h: 1226
2445+
# ./data/bindings/headers/fpdf_edit.h: 1235
2446+
if hasattr(_libs['pdfium'], 'FPDFText_LoadCidType2Font'):
2447+
FPDFText_LoadCidType2Font = _libs['pdfium']['FPDFText_LoadCidType2Font']
2448+
FPDFText_LoadCidType2Font.argtypes = [FPDF_DOCUMENT, POINTER(uint8_t), uint32_t, FPDF_BYTESTRING, POINTER(uint8_t), uint32_t]
2449+
FPDFText_LoadCidType2Font.restype = FPDF_FONT
2450+
2451+
# ./data/bindings/headers/fpdf_edit.h: 1250
24852452
if hasattr(_libs['pdfium'], 'FPDFTextObj_GetFontSize'):
24862453
FPDFTextObj_GetFontSize = _libs['pdfium']['FPDFTextObj_GetFontSize']
24872454
FPDFTextObj_GetFontSize.argtypes = [FPDF_PAGEOBJECT, POINTER(c_float)]
24882455
FPDFTextObj_GetFontSize.restype = FPDF_BOOL
24892456

2490-
# ./data/bindings/headers/fpdf_edit.h: 1231
2457+
# ./data/bindings/headers/fpdf_edit.h: 1255
24912458
if hasattr(_libs['pdfium'], 'FPDFFont_Close'):
24922459
FPDFFont_Close = _libs['pdfium']['FPDFFont_Close']
24932460
FPDFFont_Close.argtypes = [FPDF_FONT]
24942461
FPDFFont_Close.restype = None
24952462

2496-
# ./data/bindings/headers/fpdf_edit.h: 1241
2463+
# ./data/bindings/headers/fpdf_edit.h: 1265
24972464
if hasattr(_libs['pdfium'], 'FPDFPageObj_CreateTextObj'):
24982465
FPDFPageObj_CreateTextObj = _libs['pdfium']['FPDFPageObj_CreateTextObj']
24992466
FPDFPageObj_CreateTextObj.argtypes = [FPDF_DOCUMENT, FPDF_FONT, c_float]
25002467
FPDFPageObj_CreateTextObj.restype = FPDF_PAGEOBJECT
25012468

2502-
# ./data/bindings/headers/fpdf_edit.h: 1252
2469+
# ./data/bindings/headers/fpdf_edit.h: 1276
25032470
if hasattr(_libs['pdfium'], 'FPDFTextObj_GetTextRenderMode'):
25042471
FPDFTextObj_GetTextRenderMode = _libs['pdfium']['FPDFTextObj_GetTextRenderMode']
25052472
FPDFTextObj_GetTextRenderMode.argtypes = [FPDF_PAGEOBJECT]
25062473
FPDFTextObj_GetTextRenderMode.restype = FPDF_TEXT_RENDERMODE
25072474

2508-
# ./data/bindings/headers/fpdf_edit.h: 1263
2475+
# ./data/bindings/headers/fpdf_edit.h: 1287
25092476
if hasattr(_libs['pdfium'], 'FPDFTextObj_SetTextRenderMode'):
25102477
FPDFTextObj_SetTextRenderMode = _libs['pdfium']['FPDFTextObj_SetTextRenderMode']
25112478
FPDFTextObj_SetTextRenderMode.argtypes = [FPDF_PAGEOBJECT, FPDF_TEXT_RENDERMODE]
25122479
FPDFTextObj_SetTextRenderMode.restype = FPDF_BOOL
25132480

2514-
# ./data/bindings/headers/fpdf_edit.h: 1280
2481+
# ./data/bindings/headers/fpdf_edit.h: 1304
25152482
if hasattr(_libs['pdfium'], 'FPDFTextObj_GetText'):
25162483
FPDFTextObj_GetText = _libs['pdfium']['FPDFTextObj_GetText']
25172484
FPDFTextObj_GetText.argtypes = [FPDF_PAGEOBJECT, FPDF_TEXTPAGE, POINTER(FPDF_WCHAR), c_ulong]
25182485
FPDFTextObj_GetText.restype = c_ulong
25192486

2520-
# ./data/bindings/headers/fpdf_edit.h: 1299
2487+
# ./data/bindings/headers/fpdf_edit.h: 1323
25212488
if hasattr(_libs['pdfium'], 'FPDFTextObj_GetRenderedBitmap'):
25222489
FPDFTextObj_GetRenderedBitmap = _libs['pdfium']['FPDFTextObj_GetRenderedBitmap']
25232490
FPDFTextObj_GetRenderedBitmap.argtypes = [FPDF_DOCUMENT, FPDF_PAGE, FPDF_PAGEOBJECT, c_float]
25242491
FPDFTextObj_GetRenderedBitmap.restype = FPDF_BITMAP
25252492

2526-
# ./data/bindings/headers/fpdf_edit.h: 1310
2493+
# ./data/bindings/headers/fpdf_edit.h: 1334
25272494
if hasattr(_libs['pdfium'], 'FPDFTextObj_GetFont'):
25282495
FPDFTextObj_GetFont = _libs['pdfium']['FPDFTextObj_GetFont']
25292496
FPDFTextObj_GetFont.argtypes = [FPDF_PAGEOBJECT]
25302497
FPDFTextObj_GetFont.restype = FPDF_FONT
25312498

2532-
# ./data/bindings/headers/fpdf_edit.h: 1326
2499+
# ./data/bindings/headers/fpdf_edit.h: 1350
25332500
if hasattr(_libs['pdfium'], 'FPDFFont_GetFontName'):
25342501
FPDFFont_GetFontName = _libs['pdfium']['FPDFFont_GetFontName']
25352502
FPDFFont_GetFontName.argtypes = [FPDF_FONT, POINTER(c_char), c_ulong]
25362503
FPDFFont_GetFontName.restype = c_ulong
25372504

2538-
# ./data/bindings/headers/fpdf_edit.h: 1347
2505+
# ./data/bindings/headers/fpdf_edit.h: 1371
25392506
if hasattr(_libs['pdfium'], 'FPDFFont_GetFontData'):
25402507
FPDFFont_GetFontData = _libs['pdfium']['FPDFFont_GetFontData']
25412508
FPDFFont_GetFontData.argtypes = [FPDF_FONT, POINTER(uint8_t), c_size_t, POINTER(c_size_t)]
25422509
FPDFFont_GetFontData.restype = FPDF_BOOL
25432510

2544-
# ./data/bindings/headers/fpdf_edit.h: 1358
2511+
# ./data/bindings/headers/fpdf_edit.h: 1382
25452512
if hasattr(_libs['pdfium'], 'FPDFFont_GetIsEmbedded'):
25462513
FPDFFont_GetIsEmbedded = _libs['pdfium']['FPDFFont_GetIsEmbedded']
25472514
FPDFFont_GetIsEmbedded.argtypes = [FPDF_FONT]
25482515
FPDFFont_GetIsEmbedded.restype = c_int
25492516

2550-
# ./data/bindings/headers/fpdf_edit.h: 1367
2517+
# ./data/bindings/headers/fpdf_edit.h: 1391
25512518
if hasattr(_libs['pdfium'], 'FPDFFont_GetFlags'):
25522519
FPDFFont_GetFlags = _libs['pdfium']['FPDFFont_GetFlags']
25532520
FPDFFont_GetFlags.argtypes = [FPDF_FONT]
25542521
FPDFFont_GetFlags.restype = c_int
25552522

2556-
# ./data/bindings/headers/fpdf_edit.h: 1376
2523+
# ./data/bindings/headers/fpdf_edit.h: 1400
25572524
if hasattr(_libs['pdfium'], 'FPDFFont_GetWeight'):
25582525
FPDFFont_GetWeight = _libs['pdfium']['FPDFFont_GetWeight']
25592526
FPDFFont_GetWeight.argtypes = [FPDF_FONT]
25602527
FPDFFont_GetWeight.restype = c_int
25612528

2562-
# ./data/bindings/headers/fpdf_edit.h: 1388
2529+
# ./data/bindings/headers/fpdf_edit.h: 1412
25632530
if hasattr(_libs['pdfium'], 'FPDFFont_GetItalicAngle'):
25642531
FPDFFont_GetItalicAngle = _libs['pdfium']['FPDFFont_GetItalicAngle']
25652532
FPDFFont_GetItalicAngle.argtypes = [FPDF_FONT, POINTER(c_int)]
25662533
FPDFFont_GetItalicAngle.restype = FPDF_BOOL
25672534

2568-
# ./data/bindings/headers/fpdf_edit.h: 1402
2535+
# ./data/bindings/headers/fpdf_edit.h: 1426
25692536
if hasattr(_libs['pdfium'], 'FPDFFont_GetAscent'):
25702537
FPDFFont_GetAscent = _libs['pdfium']['FPDFFont_GetAscent']
25712538
FPDFFont_GetAscent.argtypes = [FPDF_FONT, c_float, POINTER(c_float)]
25722539
FPDFFont_GetAscent.restype = FPDF_BOOL
25732540

2574-
# ./data/bindings/headers/fpdf_edit.h: 1417
2541+
# ./data/bindings/headers/fpdf_edit.h: 1441
25752542
if hasattr(_libs['pdfium'], 'FPDFFont_GetDescent'):
25762543
FPDFFont_GetDescent = _libs['pdfium']['FPDFFont_GetDescent']
25772544
FPDFFont_GetDescent.argtypes = [FPDF_FONT, c_float, POINTER(c_float)]
25782545
FPDFFont_GetDescent.restype = FPDF_BOOL
25792546

2580-
# ./data/bindings/headers/fpdf_edit.h: 1433
2547+
# ./data/bindings/headers/fpdf_edit.h: 1457
25812548
if hasattr(_libs['pdfium'], 'FPDFFont_GetGlyphWidth'):
25822549
FPDFFont_GetGlyphWidth = _libs['pdfium']['FPDFFont_GetGlyphWidth']
25832550
FPDFFont_GetGlyphWidth.argtypes = [FPDF_FONT, uint32_t, c_float, POINTER(c_float)]
25842551
FPDFFont_GetGlyphWidth.restype = FPDF_BOOL
25852552

2586-
# ./data/bindings/headers/fpdf_edit.h: 1446
2553+
# ./data/bindings/headers/fpdf_edit.h: 1470
25872554
if hasattr(_libs['pdfium'], 'FPDFFont_GetGlyphPath'):
25882555
FPDFFont_GetGlyphPath = _libs['pdfium']['FPDFFont_GetGlyphPath']
25892556
FPDFFont_GetGlyphPath.argtypes = [FPDF_FONT, uint32_t, c_float]
25902557
FPDFFont_GetGlyphPath.restype = FPDF_GLYPHPATH
25912558

2592-
# ./data/bindings/headers/fpdf_edit.h: 1457
2559+
# ./data/bindings/headers/fpdf_edit.h: 1481
25932560
if hasattr(_libs['pdfium'], 'FPDFGlyphPath_CountGlyphSegments'):
25942561
FPDFGlyphPath_CountGlyphSegments = _libs['pdfium']['FPDFGlyphPath_CountGlyphSegments']
25952562
FPDFGlyphPath_CountGlyphSegments.argtypes = [FPDF_GLYPHPATH]
25962563
FPDFGlyphPath_CountGlyphSegments.restype = c_int
25972564

2598-
# ./data/bindings/headers/fpdf_edit.h: 1467
2565+
# ./data/bindings/headers/fpdf_edit.h: 1491
25992566
if hasattr(_libs['pdfium'], 'FPDFGlyphPath_GetGlyphPathSegment'):
26002567
FPDFGlyphPath_GetGlyphPathSegment = _libs['pdfium']['FPDFGlyphPath_GetGlyphPathSegment']
26012568
FPDFGlyphPath_GetGlyphPathSegment.argtypes = [FPDF_GLYPHPATH, c_int]
26022569
FPDFGlyphPath_GetGlyphPathSegment.restype = FPDF_PATHSEGMENT
26032570

2604-
# ./data/bindings/headers/fpdf_edit.h: 1475
2571+
# ./data/bindings/headers/fpdf_edit.h: 1499
26052572
if hasattr(_libs['pdfium'], 'FPDFFormObj_CountObjects'):
26062573
FPDFFormObj_CountObjects = _libs['pdfium']['FPDFFormObj_CountObjects']
26072574
FPDFFormObj_CountObjects.argtypes = [FPDF_PAGEOBJECT]
26082575
FPDFFormObj_CountObjects.restype = c_int
26092576

2610-
# ./data/bindings/headers/fpdf_edit.h: 1484
2577+
# ./data/bindings/headers/fpdf_edit.h: 1508
26112578
if hasattr(_libs['pdfium'], 'FPDFFormObj_GetObject'):
26122579
FPDFFormObj_GetObject = _libs['pdfium']['FPDFFormObj_GetObject']
26132580
FPDFFormObj_GetObject.argtypes = [FPDF_PAGEOBJECT, c_ulong]

autorelease/record.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"pdfium": 6233,
3-
"tag": "4.26.0"
2+
"pdfium": 6281,
3+
"tag": "4.27.0"
44
}

docs/devel/changelog.md

+7
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
# Changelog
88

99

10+
## 4.27.0 (2024-02-10)
11+
12+
- Updated PDFium from `6233` to `6281`.
13+
- Added ability to define `$CTYPESGEN_PIN` when building sdist via `./run craft pypi --sdist`, which allows to reproduce our sdists when set to the head commit hash of `pypdfium2-team/ctypesgen` at the time of the build to reproduce. Alternatively, you may patch the relevant `pyproject.toml` entry yourself and use `PDFIUM_PLATFORM=sdist python -m build --sdist` as usual.
14+
- Set up Dependabot for GH Actions. Updated dependencies accordingly.
15+
16+
1017
## 4.26.0 (2024-01-10)
1118

1219
- Updated PDFium from `6164` to `6233`.

docs/devel/changelog_staging.md

-2
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,3 @@
44
<!-- List character: dash (-) -->
55

66
# Changelog for next release
7-
- Added ability to define `$CTYPESGEN_PIN` when building sdist via `./run craft pypi --sdist`, which allows to reproduce our sdists when set to the head commit hash of `pypdfium2-team/ctypesgen` at the time of the build to reproduce. Alternatively, you may patch the relevant `pyproject.toml` entry yourself and use `PDFIUM_PLATFORM=sdist python -m build --sdist` as usual.
8-
- Set up Dependabot for GH Actions. Updated dependencies accordingly.

0 commit comments

Comments
 (0)