File tree Expand file tree Collapse file tree 8 files changed +64
-10
lines changed Expand file tree Collapse file tree 8 files changed +64
-10
lines changed Original file line number Diff line number Diff line change @@ -157,18 +157,30 @@ jobs:
157157      - uses : actions/checkout@v2 
158158        with :
159159          submodules : ' true' 
160- 
161160      - uses : actions/setup-python@v2 
162-         name : Install Python 
163-         with :
164-           python-version : ' 3.7' 
161+ 
162+       - name : Install dependencies 
163+         run : | 
164+           python -m pip install --upgrade pip 
165+           pip install pytest hypothesis mypy Cython==3.0.0a10 
166+ 
167+ #  The cythonized files allow installation from the sdist without cython
168+       - name : Generate cython 
169+         run : | 
170+           chmod +x ./src/Levenshtein/generate.sh 
171+           ./src/Levenshtein/generate.sh 
165172
166173name : Build sdist 
167174        run : | 
168-           pip3 install build; python3 -m build --sdist 
175+           git apply ./tools/sdist.patch 
176+           pip install build 
177+           python -m build --sdist 
169178          # test whether tarball contains all files required for compiling 
170-           pip3 install dist/Levenshtein-*.tar.gz 
171-           pip3 uninstall Levenshtein --yes 
179+           pip install dist/Levenshtein-*.tar.gz 
180+ 
181+ name : Test with pytest and backtrace in case of SegFault 
182+         run : | 
183+           tools/seg_wrapper.sh pytest tests 
172184
173185uses : actions/upload-artifact@v2 
174186        with :
Original file line number Diff line number Diff line change @@ -20,7 +20,6 @@ endif()
2020
2121find_package (PythonExtensions REQUIRED)
2222find_package (Python COMPONENTS Interpreter Development)
23- find_package (Cython REQUIRED)
2423
2524find_package (rapidfuzz 1.0.4 QUIET )
2625if  (rapidfuzz_FOUND)
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ include src/Levenshtein/**/*.pyi
88include src/Levenshtein/py.typed
99
1010recursive-include src/Levenshtein CMakeLists.txt
11- recursive-include src/Levenshtein *.hpp *.h *.cpp *.pyx *.pxd
11+ recursive-include src/Levenshtein *.hpp *.h *.cpp *.pyx *.pxd *.cxx 
1212
1313include extern/rapidfuzz-cpp/LICENSE
1414include extern/rapidfuzz-cpp/CMakeLists.txt
Original file line number Diff line number Diff line change 11
2- add_cython_target(levenshtein_cpp CXX)
2+ function (create_cython_target _name)
3+ if (EXISTS  ${CMAKE_CURRENT_LIST_DIR} /${_name} .cxx)
4+     set (${_name}  ${CMAKE_CURRENT_LIST_DIR} /${_name} .cxx PARENT_SCOPE)
5+ else ()
6+     find_package (Cython REQUIRED)
7+     add_cython_target(${_name}  CXX)
8+     set (${_name}  ${_name}  PARENT_SCOPE)
9+ endif ()
10+ endfunction (create_cython_target)
11+ 
12+ create_cython_target(levenshtein_cpp)
313add_library (levenshtein_cpp MODULE ${levenshtein_cpp}  ${LEV_BASE_DIR} /Levenshtein-c/_levenshtein.cpp)
414target_compile_features (levenshtein_cpp PUBLIC  cxx_std_14)
515target_include_directories (levenshtein_cpp PRIVATE  ${LEV_BASE_DIR} /Levenshtein-c)
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+ curdir=" ${0%/* } " 
3+ 
4+ generate_cython ()
5+ {
6+   python -m cython -I " $curdir " " $curdir " " $1 " " $curdir " " $1 " ||  exit  1
7+   echo  " Generated $curdir /$1 .cxx" 
8+ }
9+ 
10+ generate_cython levenshtein_cpp
Original file line number Diff line number Diff line change 1+ backtrace
2+ quit
Original file line number Diff line number Diff line change 1+ diff --git a/pyproject.toml b/pyproject.toml 
2+ index 13a4e16..edb35af 100644
3+ --- a/pyproject.toml 
4+ +++ b/pyproject.toml 
5+ @@ -3,7 +3,6 @@  requires = [
6+      "setuptools",
7+      "scikit-build>=0.13.0",
8+      "cmake",
9+ -     "ninja; platform_system!='Windows'",
10+ -     "Cython==3.0.0a10"
11+ +     "ninja; platform_system!='Windows'"
12+  ]
13+  build-backend = "setuptools.build_meta"
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ SCRIPTPATH=" $(  cd  -- " $( dirname " $0 " ) " > /dev/null 2>&1  ;  pwd  -P ) " 
3+ 
4+ ulimit  -c unlimited
5+ " $@ " 
6+ if  [[ $?  -eq  139 ]];  then 
7+     coredumpctl gdb -1 -A " --batch -x $SCRIPTPATH /backtrace" 
8+ fi 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments