make Linux behavior default for loading Python shared lib

This adds portability to platforms like FreeBSD
This commit is contained in:
Axel Kohlmeyer
2022-10-21 15:32:55 -04:00
parent caeaeb5d33
commit 1d69e93330

View File

@ -10,15 +10,15 @@ import warnings
py_ver = sysconfig.get_config_vars('VERSION')[0] py_ver = sysconfig.get_config_vars('VERSION')[0]
OS_name = platform.system() OS_name = platform.system()
if OS_name == "Linux": if OS_name == "Darwin":
SHLIB_SUFFIX = '.so'
library = 'libpython' + py_ver + SHLIB_SUFFIX
elif OS_name == "Darwin":
SHLIB_SUFFIX = '.dylib' SHLIB_SUFFIX = '.dylib'
library = 'libpython' + py_ver + SHLIB_SUFFIX library = 'libpython' + py_ver + SHLIB_SUFFIX
elif OS_name == "Windows": elif OS_name == "Windows":
SHLIB_SUFFIX = '.dll' SHLIB_SUFFIX = '.dll'
library = 'python' + py_ver + SHLIB_SUFFIX library = 'python' + py_ver + SHLIB_SUFFIX
else:
SHLIB_SUFFIX = '.so'
library = 'libpython' + py_ver + SHLIB_SUFFIX
try: try:
pylib = ctypes.CDLL(library) pylib = ctypes.CDLL(library)