Skip to content

Commit

Permalink
[autorelease main] update 4.27.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mara004 committed Feb 10, 2024
1 parent 2d165af commit 4c4c362
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 75 deletions.
109 changes: 38 additions & 71 deletions autorelease/bindings.py
Original file line number Diff line number Diff line change
@@ -1,47 +1,20 @@
R"""
Auto-generated by:
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
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
"""

# -- Begin preamble --

# TODO
# - add c_ptrdiff_t only on as-needed basis
# - Avoid ctypes glob import (pollutes namespace)

import ctypes
from ctypes import * # noqa: F401, F403

def _get_ptrdiff_t():

int_types = (ctypes.c_int16, ctypes.c_int32)
if hasattr(ctypes, "c_int64"):
# Some builds of ctypes apparently do not have ctypes.c_int64
# defined; it's a pretty good bet that these builds do not
# have 64-bit pointers.
int_types += (ctypes.c_int64,)

c_ptrdiff_t = None
for t in int_types:
if ctypes.sizeof(t) == ctypes.sizeof(ctypes.c_size_t):
c_ptrdiff_t = t

return c_ptrdiff_t

c_ptrdiff_t = _get_ptrdiff_t()

# -- End preamble --
from ctypes import *


# -- Begin loader template --

import sys
import ctypes
import ctypes.util
import warnings
import pathlib

def _find_library(name, dirs, search_sys, reldir=None):
def _find_library(name, dirs, search_sys):

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

if reldir is None:
try:
reldir = pathlib.Path(__file__).parent
except NameError:
reldir = None

for dir in dirs:
dir = pathlib.Path(dir)
if not dir.is_absolute():
# NOTE joining an absolute path silently discardy the path before
assert reldir != None, "cannot resolve relative paths without anchor point (__file__ not defined?)"
dir = (reldir/dir).resolve(strict=False)
dir = (pathlib.Path(__file__).parent / dir).resolve(strict=False)
for pat in patterns:
libpath = dir / pat.format(name)
if libpath.is_file():
return str(libpath)

if search_sys:
if dirs:
warnings.warn(f"Could not find library '{name}' in {dirs}, falling back to system")
libpath = ctypes.util.find_library(name)
if not libpath:
raise ImportError(f"Could not find library '{name}' in system")
return libpath
else:
raise ImportError(f"Could not find library '{name}' in {dirs} (system search disabled)")
libpath = ctypes.util.find_library(name) if search_sys else None
if not libpath:
raise ImportError(f"Could not find library '{name}' (dirs={dirs}, search_sys={search_sys})")

return libpath

_libs_info, _libs = {}, {}

def _register_library(name, dllclass, **kwargs):
libpath = _find_library(name, **kwargs)
assert libpath, "output expected from _find_library()"
_libs_info[name] = {"name": name, "dllclass": dllclass, **kwargs, "path": libpath}
_libs_info[name] = {**kwargs, "path": libpath}
_libs[name] = dllclass(libpath)

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

# ./data/bindings/headers/fpdf_edit.h: 1226
# ./data/bindings/headers/fpdf_edit.h: 1235
if hasattr(_libs['pdfium'], 'FPDFText_LoadCidType2Font'):
FPDFText_LoadCidType2Font = _libs['pdfium']['FPDFText_LoadCidType2Font']
FPDFText_LoadCidType2Font.argtypes = [FPDF_DOCUMENT, POINTER(uint8_t), uint32_t, FPDF_BYTESTRING, POINTER(uint8_t), uint32_t]
FPDFText_LoadCidType2Font.restype = FPDF_FONT

# ./data/bindings/headers/fpdf_edit.h: 1250
if hasattr(_libs['pdfium'], 'FPDFTextObj_GetFontSize'):
FPDFTextObj_GetFontSize = _libs['pdfium']['FPDFTextObj_GetFontSize']
FPDFTextObj_GetFontSize.argtypes = [FPDF_PAGEOBJECT, POINTER(c_float)]
FPDFTextObj_GetFontSize.restype = FPDF_BOOL

# ./data/bindings/headers/fpdf_edit.h: 1231
# ./data/bindings/headers/fpdf_edit.h: 1255
if hasattr(_libs['pdfium'], 'FPDFFont_Close'):
FPDFFont_Close = _libs['pdfium']['FPDFFont_Close']
FPDFFont_Close.argtypes = [FPDF_FONT]
FPDFFont_Close.restype = None

# ./data/bindings/headers/fpdf_edit.h: 1241
# ./data/bindings/headers/fpdf_edit.h: 1265
if hasattr(_libs['pdfium'], 'FPDFPageObj_CreateTextObj'):
FPDFPageObj_CreateTextObj = _libs['pdfium']['FPDFPageObj_CreateTextObj']
FPDFPageObj_CreateTextObj.argtypes = [FPDF_DOCUMENT, FPDF_FONT, c_float]
FPDFPageObj_CreateTextObj.restype = FPDF_PAGEOBJECT

# ./data/bindings/headers/fpdf_edit.h: 1252
# ./data/bindings/headers/fpdf_edit.h: 1276
if hasattr(_libs['pdfium'], 'FPDFTextObj_GetTextRenderMode'):
FPDFTextObj_GetTextRenderMode = _libs['pdfium']['FPDFTextObj_GetTextRenderMode']
FPDFTextObj_GetTextRenderMode.argtypes = [FPDF_PAGEOBJECT]
FPDFTextObj_GetTextRenderMode.restype = FPDF_TEXT_RENDERMODE

# ./data/bindings/headers/fpdf_edit.h: 1263
# ./data/bindings/headers/fpdf_edit.h: 1287
if hasattr(_libs['pdfium'], 'FPDFTextObj_SetTextRenderMode'):
FPDFTextObj_SetTextRenderMode = _libs['pdfium']['FPDFTextObj_SetTextRenderMode']
FPDFTextObj_SetTextRenderMode.argtypes = [FPDF_PAGEOBJECT, FPDF_TEXT_RENDERMODE]
FPDFTextObj_SetTextRenderMode.restype = FPDF_BOOL

# ./data/bindings/headers/fpdf_edit.h: 1280
# ./data/bindings/headers/fpdf_edit.h: 1304
if hasattr(_libs['pdfium'], 'FPDFTextObj_GetText'):
FPDFTextObj_GetText = _libs['pdfium']['FPDFTextObj_GetText']
FPDFTextObj_GetText.argtypes = [FPDF_PAGEOBJECT, FPDF_TEXTPAGE, POINTER(FPDF_WCHAR), c_ulong]
FPDFTextObj_GetText.restype = c_ulong

# ./data/bindings/headers/fpdf_edit.h: 1299
# ./data/bindings/headers/fpdf_edit.h: 1323
if hasattr(_libs['pdfium'], 'FPDFTextObj_GetRenderedBitmap'):
FPDFTextObj_GetRenderedBitmap = _libs['pdfium']['FPDFTextObj_GetRenderedBitmap']
FPDFTextObj_GetRenderedBitmap.argtypes = [FPDF_DOCUMENT, FPDF_PAGE, FPDF_PAGEOBJECT, c_float]
FPDFTextObj_GetRenderedBitmap.restype = FPDF_BITMAP

# ./data/bindings/headers/fpdf_edit.h: 1310
# ./data/bindings/headers/fpdf_edit.h: 1334
if hasattr(_libs['pdfium'], 'FPDFTextObj_GetFont'):
FPDFTextObj_GetFont = _libs['pdfium']['FPDFTextObj_GetFont']
FPDFTextObj_GetFont.argtypes = [FPDF_PAGEOBJECT]
FPDFTextObj_GetFont.restype = FPDF_FONT

# ./data/bindings/headers/fpdf_edit.h: 1326
# ./data/bindings/headers/fpdf_edit.h: 1350
if hasattr(_libs['pdfium'], 'FPDFFont_GetFontName'):
FPDFFont_GetFontName = _libs['pdfium']['FPDFFont_GetFontName']
FPDFFont_GetFontName.argtypes = [FPDF_FONT, POINTER(c_char), c_ulong]
FPDFFont_GetFontName.restype = c_ulong

# ./data/bindings/headers/fpdf_edit.h: 1347
# ./data/bindings/headers/fpdf_edit.h: 1371
if hasattr(_libs['pdfium'], 'FPDFFont_GetFontData'):
FPDFFont_GetFontData = _libs['pdfium']['FPDFFont_GetFontData']
FPDFFont_GetFontData.argtypes = [FPDF_FONT, POINTER(uint8_t), c_size_t, POINTER(c_size_t)]
FPDFFont_GetFontData.restype = FPDF_BOOL

# ./data/bindings/headers/fpdf_edit.h: 1358
# ./data/bindings/headers/fpdf_edit.h: 1382
if hasattr(_libs['pdfium'], 'FPDFFont_GetIsEmbedded'):
FPDFFont_GetIsEmbedded = _libs['pdfium']['FPDFFont_GetIsEmbedded']
FPDFFont_GetIsEmbedded.argtypes = [FPDF_FONT]
FPDFFont_GetIsEmbedded.restype = c_int

# ./data/bindings/headers/fpdf_edit.h: 1367
# ./data/bindings/headers/fpdf_edit.h: 1391
if hasattr(_libs['pdfium'], 'FPDFFont_GetFlags'):
FPDFFont_GetFlags = _libs['pdfium']['FPDFFont_GetFlags']
FPDFFont_GetFlags.argtypes = [FPDF_FONT]
FPDFFont_GetFlags.restype = c_int

# ./data/bindings/headers/fpdf_edit.h: 1376
# ./data/bindings/headers/fpdf_edit.h: 1400
if hasattr(_libs['pdfium'], 'FPDFFont_GetWeight'):
FPDFFont_GetWeight = _libs['pdfium']['FPDFFont_GetWeight']
FPDFFont_GetWeight.argtypes = [FPDF_FONT]
FPDFFont_GetWeight.restype = c_int

# ./data/bindings/headers/fpdf_edit.h: 1388
# ./data/bindings/headers/fpdf_edit.h: 1412
if hasattr(_libs['pdfium'], 'FPDFFont_GetItalicAngle'):
FPDFFont_GetItalicAngle = _libs['pdfium']['FPDFFont_GetItalicAngle']
FPDFFont_GetItalicAngle.argtypes = [FPDF_FONT, POINTER(c_int)]
FPDFFont_GetItalicAngle.restype = FPDF_BOOL

# ./data/bindings/headers/fpdf_edit.h: 1402
# ./data/bindings/headers/fpdf_edit.h: 1426
if hasattr(_libs['pdfium'], 'FPDFFont_GetAscent'):
FPDFFont_GetAscent = _libs['pdfium']['FPDFFont_GetAscent']
FPDFFont_GetAscent.argtypes = [FPDF_FONT, c_float, POINTER(c_float)]
FPDFFont_GetAscent.restype = FPDF_BOOL

# ./data/bindings/headers/fpdf_edit.h: 1417
# ./data/bindings/headers/fpdf_edit.h: 1441
if hasattr(_libs['pdfium'], 'FPDFFont_GetDescent'):
FPDFFont_GetDescent = _libs['pdfium']['FPDFFont_GetDescent']
FPDFFont_GetDescent.argtypes = [FPDF_FONT, c_float, POINTER(c_float)]
FPDFFont_GetDescent.restype = FPDF_BOOL

# ./data/bindings/headers/fpdf_edit.h: 1433
# ./data/bindings/headers/fpdf_edit.h: 1457
if hasattr(_libs['pdfium'], 'FPDFFont_GetGlyphWidth'):
FPDFFont_GetGlyphWidth = _libs['pdfium']['FPDFFont_GetGlyphWidth']
FPDFFont_GetGlyphWidth.argtypes = [FPDF_FONT, uint32_t, c_float, POINTER(c_float)]
FPDFFont_GetGlyphWidth.restype = FPDF_BOOL

# ./data/bindings/headers/fpdf_edit.h: 1446
# ./data/bindings/headers/fpdf_edit.h: 1470
if hasattr(_libs['pdfium'], 'FPDFFont_GetGlyphPath'):
FPDFFont_GetGlyphPath = _libs['pdfium']['FPDFFont_GetGlyphPath']
FPDFFont_GetGlyphPath.argtypes = [FPDF_FONT, uint32_t, c_float]
FPDFFont_GetGlyphPath.restype = FPDF_GLYPHPATH

# ./data/bindings/headers/fpdf_edit.h: 1457
# ./data/bindings/headers/fpdf_edit.h: 1481
if hasattr(_libs['pdfium'], 'FPDFGlyphPath_CountGlyphSegments'):
FPDFGlyphPath_CountGlyphSegments = _libs['pdfium']['FPDFGlyphPath_CountGlyphSegments']
FPDFGlyphPath_CountGlyphSegments.argtypes = [FPDF_GLYPHPATH]
FPDFGlyphPath_CountGlyphSegments.restype = c_int

# ./data/bindings/headers/fpdf_edit.h: 1467
# ./data/bindings/headers/fpdf_edit.h: 1491
if hasattr(_libs['pdfium'], 'FPDFGlyphPath_GetGlyphPathSegment'):
FPDFGlyphPath_GetGlyphPathSegment = _libs['pdfium']['FPDFGlyphPath_GetGlyphPathSegment']
FPDFGlyphPath_GetGlyphPathSegment.argtypes = [FPDF_GLYPHPATH, c_int]
FPDFGlyphPath_GetGlyphPathSegment.restype = FPDF_PATHSEGMENT

# ./data/bindings/headers/fpdf_edit.h: 1475
# ./data/bindings/headers/fpdf_edit.h: 1499
if hasattr(_libs['pdfium'], 'FPDFFormObj_CountObjects'):
FPDFFormObj_CountObjects = _libs['pdfium']['FPDFFormObj_CountObjects']
FPDFFormObj_CountObjects.argtypes = [FPDF_PAGEOBJECT]
FPDFFormObj_CountObjects.restype = c_int

# ./data/bindings/headers/fpdf_edit.h: 1484
# ./data/bindings/headers/fpdf_edit.h: 1508
if hasattr(_libs['pdfium'], 'FPDFFormObj_GetObject'):
FPDFFormObj_GetObject = _libs['pdfium']['FPDFFormObj_GetObject']
FPDFFormObj_GetObject.argtypes = [FPDF_PAGEOBJECT, c_ulong]
Expand Down
4 changes: 2 additions & 2 deletions autorelease/record.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"pdfium": 6233,
"tag": "4.26.0"
"pdfium": 6281,
"tag": "4.27.0"
}
7 changes: 7 additions & 0 deletions docs/devel/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
# Changelog


## 4.27.0 (2024-02-10)

- Updated PDFium from `6233` to `6281`.
- 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.
- Set up Dependabot for GH Actions. Updated dependencies accordingly.


## 4.26.0 (2024-01-10)

- Updated PDFium from `6164` to `6233`.
Expand Down
2 changes: 0 additions & 2 deletions docs/devel/changelog_staging.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,3 @@
<!-- List character: dash (-) -->

# Changelog for next release
- 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.
- Set up Dependabot for GH Actions. Updated dependencies accordingly.

0 comments on commit 4c4c362

Please sign in to comment.