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

Windows build: Support for python 3.8 and up #248

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion cairo/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
import os
added_dirs = []
if os.name == 'nt' and hasattr(os, 'add_dll_directory'):
path = os.environ.get('PATH', '')
for p in path.split(os.pathsep):
if p != "" and os.path.isfile(os.path.join(p, 'cairo.dll')):
# Found a cairo.dll -> add to the list
added_dirs.append(os.add_dll_directory(p))
from ._cairo import * # noqa: F401,F403

if added_dirs:
# remove the added dirs
for d in added_dirs:
d.close()
del added_dirs

def get_include():
"""Returns a path to the directory containing the C header files"""
Expand Down