From 2eebd8b5612fbd65d433f3c0ac0e3415aec54caa Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 25 May 2023 07:22:45 +0530 Subject: [PATCH 1/4] ... --- src/calibre/utils/podofo/global.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/calibre/utils/podofo/global.h b/src/calibre/utils/podofo/global.h index 87a56cb04b..b1b1e699b5 100644 --- a/src/calibre/utils/podofo/global.h +++ b/src/calibre/utils/podofo/global.h @@ -131,6 +131,7 @@ object_as_reference(const PdfObject *o) { } // Needed to avoid PoDoFo clobbering the /Info and XMP metadata with its own nonsense +// rename to NoMetadataUdate after https://github.com/podofo/podofo/commit/96689eb6e45b71eae1577ecb2d4a796c52e9a813 static const PdfSaveOptions save_options = PdfSaveOptions::NoModifyDateUpdate; class PdfReferenceHasher { From db74bfa41eb3714452e2fc46e7747b16ace87863 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 25 May 2023 08:12:14 +0530 Subject: [PATCH 2/4] A more convenient way to build against a custom podofo 0.10 --- setup/build_environment.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/setup/build_environment.py b/setup/build_environment.py index e9d5ddfa85..3918e048bb 100644 --- a/setup/build_environment.py +++ b/setup/build_environment.py @@ -207,9 +207,14 @@ else: uchardet_libs = pkgconfig_libs('uchardet', '', '') +if 'PODOFO_PREFIX' in os.environ: + os.environ['PODOFO_LIB_DIR'] = os.path.join(os.environ['PODOFO_PREFIX'], 'lib') + os.environ['PODOFO_INC_DIR'] = os.path.join(os.environ['PODOFO_PREFIX'], 'include', 'podofo') + os.environ['PODOFO_LIB_NAME'] = os.path.join(os.environ['PODOFO_PREFIX'], 'lib', 'libpodofo.so.1') podofo_lib = os.environ.get('PODOFO_LIB_DIR', podofo_lib) podofo_inc = os.environ.get('PODOFO_INC_DIR', podofo_inc) podofo = os.environ.get('PODOFO_LIB_NAME', 'podofo') + podofo_error = None if os.path.exists(os.path.join(podofo_inc, 'podofo.h')) else \ ('PoDoFo not found on your system. Various PDF related', ' functionality will not work. Use the PODOFO_INC_DIR and', From b7795f989eb86cfa3ef5e2920e008f7ad26126e0 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 25 May 2023 08:32:41 +0530 Subject: [PATCH 3/4] Fix invocation of ruff since its CLI has changed --- setup/check.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/check.py b/setup/check.py index 22c88ccd31..2b64eb6bd3 100644 --- a/setup/check.py +++ b/setup/check.py @@ -77,7 +77,7 @@ class Check(Command): def file_has_errors(self, f): ext = os.path.splitext(f)[1] if ext in {'.py', '.recipe'}: - p2 = subprocess.Popen(['ruff', '--no-update-check', f]) + p2 = subprocess.Popen(['ruff', 'check', f]) return p2.wait() != 0 if ext == '.pyj': p = subprocess.Popen(['rapydscript', 'lint', f]) From fd207da67c69bca03dc1bdf04a43c88d9c7dd04c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 25 May 2023 08:33:02 +0530 Subject: [PATCH 4/4] Fix use of _ as local variable and gettext in same scope --- src/calibre/utils/formatter_functions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/utils/formatter_functions.py b/src/calibre/utils/formatter_functions.py index 814c314139..0bfd0cb000 100644 --- a/src/calibre/utils/formatter_functions.py +++ b/src/calibre/utils/formatter_functions.py @@ -822,11 +822,11 @@ class BuiltinIdentifierInList(BuiltinFormatterFunction): raise ValueError(_("{} requires 2 or 4 arguments").format(self.name)) l = [v.strip() for v in val.split(',') if v.strip()] - (id_, _, regexp) = ident.partition(':') + (id_, __, regexp) = ident.partition(':') if not id_: return nfv for candidate in l: - i, _, v = candidate.partition(':') + i, __, v = candidate.partition(':') if v and i == id_: if not regexp or re.search(regexp, v, flags=re.I): return candidate if fv_is_id else fv