Skip to content

Commit

Permalink
backport WITH_SOABI
Browse files Browse the repository at this point in the history
  • Loading branch information
maxbachmann committed Sep 27, 2022
1 parent 0cad397 commit bd01446
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,9 @@
## Changelog

### [1.2.3] - 2022-08-27
#### Fixed
- fix support for cmake versions below 3.17

### [1.2.2] - 2022-08-25
#### Changed
- modernize cmake build to fix most conda-forge builds
Expand Down
9 changes: 8 additions & 1 deletion CMakeLists.txt
Expand Up @@ -13,7 +13,14 @@ else()
find_package(Python COMPONENTS Interpreter Development.Module REQUIRED)
endif()

if("${Python_INTERPRETER_ID}" STREQUAL "PyPy")
if(CMAKE_VERSION VERSION_LESS 3.17)
execute_process(
COMMAND "${Python_EXECUTABLE}" -c
"import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX').split('.')[1])"
OUTPUT_VARIABLE Python_SOABI
OUTPUT_STRIP_TRAILING_WHITESPACE COMMAND_ECHO STDOUT)
message(STATUS "Corrected SOABI: ${Python_SOABI}")
elseif("${Python_INTERPRETER_ID}" STREQUAL "PyPy")
message(STATUS "PyPy SOABI: ${Python_SOABI}")
execute_process(
COMMAND "${Python_EXECUTABLE}" -c
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -11,7 +11,7 @@ def show_message(*lines):

setup_args = {
"name": "jarowinkler",
"version": "1.2.2",
"version": "1.2.3",
"url": "https://github.com/maxbachmann/JaroWinkler",
"author": "Max Bachmann",
"author_email": "pypi@maxbachmann.de",
Expand Down
15 changes: 14 additions & 1 deletion src/jarowinkler/CMakeLists.txt
Expand Up @@ -10,8 +10,21 @@ function(create_cython_target _name)
endif()
endfunction(create_cython_target)

function(rf_add_library name)
if(CMAKE_VERSION VERSION_LESS 3.17)
Python_add_library(${name} MODULE ${ARGV})
get_property(suffix TARGET ${name} PROPERTY SUFFIX)
if (NOT suffix)
set (suffix "${CMAKE_SHARED_MODULE_SUFFIX}")
endif()
set_property (TARGET ${name} PROPERTY SUFFIX ".${Python_SOABI}${suffix}")
else()
Python_add_library(${name} MODULE WITH_SOABI ${ARGV})
endif()
endfunction(rf_add_library)

create_cython_target(_initialize_cpp)
Python_add_library(_initialize_cpp MODULE WITH_SOABI ${_initialize_cpp})
rf_add_library(_initialize_cpp ${_initialize_cpp})
target_compile_features(_initialize_cpp PUBLIC cxx_std_14)
target_include_directories(_initialize_cpp PRIVATE ${RF_CAPI_PATH} ${JW_BASE_DIR}/jarowinkler)
target_link_libraries(_initialize_cpp PRIVATE jaro_winkler::jaro_winkler)
Expand Down
2 changes: 1 addition & 1 deletion src/jarowinkler/__init__.py
@@ -1,6 +1,6 @@
__author__: str = "Max Bachmann"
__license__: str = "MIT"
__version__: str = "1.2.2"
__version__: str = "1.2.3"

def _fallback_import(module: str, name: str):
import importlib
Expand Down

0 comments on commit bd01446

Please sign in to comment.