Skip to content

Commit 5adf7e3

Browse files
committed
[SQUASH] Debug library paths on Windows.
Add a special case for Windows.
1 parent 50e568b commit 5adf7e3

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,9 +340,16 @@ def add_library_path(path):
340340
apipath_extra = os.path.join(os.path.dirname(apipath), 'site', 'python'+ldversion)
341341
if not os.path.exists(os.path.join(apipath_extra, 'CPyCppyy')):
342342
import glob
343+
import platform
343344

344-
import cppyy.libcppyy as libcppyy
345-
ape = os.path.dirname(libcppyy.__file__)
345+
if platform.system() == "Windows":
346+
# On Windows, the library is found directly
347+
import libcppyy
348+
ape = os.path.dirname(libcppyy.__file__)
349+
print("libcppyy was found in", ape)
350+
else:
351+
import cppyy.libcppyy as libcppyy
352+
ape = os.path.dirname(libcppyy.__file__)
346353
# a "normal" structure finds the include directory up to 3 levels up,
347354
# ie. dropping lib/pythonx.y[md]/site-packages
348355
for i in range(3):

bindings/pyroot/cppyy/cppyy/python/cppyy/_cpython_cppyy.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""
33

44
import ctypes
5+
import platform
56
import sys
67

78
from . import _stdcpp_fix
@@ -27,7 +28,12 @@
2728
except ImportError:
2829
c = None
2930

30-
import cppyy.libcppyy as _backend
31+
if platform.system() == "Windows":
32+
# On Windows, the library has to be searched without prefix
33+
import libcppyy as _backend
34+
print("libcppyy was found in", _backend.__file__)
35+
else:
36+
import cppyy.libcppyy as _backend
3137

3238
if c is not None:
3339
_backend._cpp_backend = c

0 commit comments

Comments
 (0)