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

Improve libpython search with python's sysconfig INSTSONAME #179

Merged
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# jpy Changelog

## Version 1.1.0 (in development)
* [#179](https://github.com/jpy-consortium/jpy/pull/179) Improve libpython search with python's sysconfig INSTSONAME

## Version 1.0.0
* [#176](https://github.com/jpy-consortium/jpy/pull/176) fix: make PyObject cleanup thread-safe in free-threaded Python and reduce contention
Expand Down
11 changes: 7 additions & 4 deletions jpyutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,9 @@ def _find_python_dll_file(fail=False):
logger.debug("Potential Python shared library search dirs: %s" % repr(search_dirs))

# Prepare list of possible library file names
# Prefer "Install .so name" as first candidate for file_names
instsoname = sysconfig.get_config_var("INSTSONAME")
file_names = [ instsoname ] if instsoname else []

# account for Python debug builds

Expand All @@ -346,14 +349,14 @@ def _find_python_dll_file(fail=False):

if platform.system() == 'Windows':
versions = (vmaj + vmin, vmaj, vmaj + vmin + dll_suffix, '')
file_names = ['python' + v + '.dll' for v in versions]
file_names += ['python' + v + '.dll' for v in versions]
elif platform.system() == 'Darwin':
versions = (vmaj + "." + vmin, vmaj, vmaj + "." + vmin + dll_suffix, '')
file_names = ['libpython' + v + '.dylib' for v in versions] + \
['libpython' + v + '.so' for v in versions]
file_names += ['libpython' + v + '.dylib' for v in versions]
file_names += ['libpython' + v + '.so' for v in versions]
else:
versions = (vmaj + "." + vmin, vmaj, vmaj + "." + vmin + dll_suffix, '')
file_names = ['libpython' + v + '.so' for v in versions]
file_names += ['libpython' + v + '.so' for v in versions]

logger.debug("Potential Python shared library file names: %s" % repr(file_names))

Expand Down
Loading