Skip to content

Commit

Permalink
Counterpart to ctypesgen library_sharing branch (#285)
Browse files Browse the repository at this point in the history
  • Loading branch information
mara004 authored Dec 11, 2023
1 parent 45dbb2c commit 51612d3
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/pypdfium2/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,17 @@
import argparse
import importlib
from pypdfium2.version import PYPDFIUM_INFO, PDFIUM_INFO
# the * import in pypdfium2.raw loses underscore-prefixed members, so import from the direct origin
from pypdfium2_raw.bindings import _loader_info as loader_info
from pypdfium2._cli._parsers import setup_logging

try:
from pypdfium2_raw.bindings import _libs_info
pdfium_path = _libs_info["pdfium"]["path"]
except ImportError:
# retained for downward compatibility with conda pypdfium2_raw <= 6164 by date of initial build
# actually it's the ctypesgen version that matters, but we don't have info about that
from pypdfium2_raw.bindings import _loader_info
pdfium_path = _loader_info["libpath"]

SubCommands = {
"arrange": "rearrange/merge documents",
"attachments": "list/extract/edit embedded files",
Expand All @@ -35,7 +42,7 @@ def get_parser():
main_parser.add_argument(
"--version", "-v",
action = "version",
version = f"pypdfium2 {PYPDFIUM_INFO}\n" f"pdfium {PDFIUM_INFO} at {loader_info['libpath']}"
version = f"pypdfium2 {PYPDFIUM_INFO}\n" f"pdfium {PDFIUM_INFO} at {pdfium_path}"
)
subparsers = main_parser.add_subparsers(dest="subcommand")

Expand Down

0 comments on commit 51612d3

Please sign in to comment.