Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ctypesgen bindings generation fails on Windows #71

Closed
mara004 opened this issue Feb 19, 2022 · 1 comment
Closed

Ctypesgen bindings generation fails on Windows #71

mara004 opened this issue Feb 19, 2022 · 1 comment

Comments

@mara004
Copy link
Member

mara004 commented Feb 19, 2022

At the moment, ctypesgen appears to be unable to create the bindings file on Windows (see ctypesgen/ctypesgen#138).
This means that Windows users cannot easily install pypdfium2 from git main, unfortunately. (Using the release wheels on PyPI will works, of course. This issue only applies if you want to install the latest state of the repository from source.)

In the meantime, I have attached the current bindings file so that users may inject it manually: _pypdfium.py.txt
Then it should be possible to create and install a wheel somewhat like this:

@echo off

REM Prerequisite: You are in the `pypdfium/` directory

REM Define the target platform (in this case, Windows 64-bit amd/intel)
set PYP_TARGET_PLATFORM="windows_x64"

REM Download binary
python3 platform_setup\update_pdfium.py -p %PYP_TARGET_PLATFORM%

REM Now you need to manually copy the attached bindings file into `data/%PYP_TARGET_PLATFORM%`
REM (Remember to remove the `.txt` extension which was only for the upload to GitHub)

REM Build the wheel, according to the target platform environment variable
python3 -m build -n -x --wheel

REM Finally, install it (replace `WHEELNAME_HERE.whl` with the corresponding file name)
python3 -m pip install dist/WHEELNAME_HERE.whl

REM Optionally, run the test suite
python3 -m pytest tests/
@mara004 mara004 added upstream The root cause of this issue is in an upstream dependency. ctypesgen Issue related to ctypesgen labels Feb 19, 2022
@mara004 mara004 pinned this issue Feb 19, 2022
@mara004 mara004 unpinned this issue Feb 19, 2022
@mara004
Copy link
Member Author

mara004 commented Feb 20, 2022

Turns out I only had an unstable version of ctypesgen installed. Updating to a more recent commit fixed the issue.

@mara004 mara004 closed this as completed Feb 20, 2022
@mara004 mara004 removed upstream The root cause of this issue is in an upstream dependency. ctypesgen Issue related to ctypesgen labels Feb 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant