Browse Source

python: add implicit DLL search paths on Windows, if they exist.

This should make self-contained builds *actually* working out-of-the
box, without having to fiddle with PATH or nasty copying of all DLLs
somewhere inside a Python installation.
next
Vladimír Vondruš 3 years ago
parent
commit
6298ca29fd
  1. 16
      src/python/corrade/__init__.py
  2. 4
      src/python/magnum/__init__.py

16
src/python/corrade/__init__.py

@ -25,6 +25,22 @@
"""Root Corrade module"""
# On Windows, if a known directory layout is detected, add paths containing
# binaries to the DLL search path
import platform
if platform.system() == 'Windows':
import os
for directory in [
# Prebuilt binaries from the magnum-ci repo have this file in
# python/corrade/ and DLLs in bin/
'../../bin'
]:
bin_path = os.path.join(os.path.dirname(__file__), directory)
if os.path.exists(bin_path):
os.add_dll_directory(bin_path)
break
from _corrade import *
import sys

4
src/python/magnum/__init__.py

@ -25,6 +25,10 @@
"""Root Magnum module"""
# Important -- performs various platform-specific setup like adding DLL paths
# on Windows
import corrade
from _magnum import *
# This feels extremely hackish, but without that it wouldn't be possible to

Loading…
Cancel
Save