Skip to content
forked from aleaxit/gmpy

Commit

Permalink
Run Cython tests for binary wheels
Browse files Browse the repository at this point in the history
  • Loading branch information
skirpichev committed Dec 22, 2023
1 parent 8a39f52 commit 3c86ae8
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ jobs:
CIBW_BEFORE_BUILD: bash scripts/before_ci_build.sh
CIBW_TEST_EXTRAS: tests
CIBW_TEST_COMMAND: pytest {package}/test/
CIBW_TEST_COMMAND_LINUX: >
pytest {package}/test/ &&
python {package}/test_cython/runtests.py
CIBW_REPAIR_WHEEL_COMMAND_LINUX: >
bash scripts/repair_ci_wheel_linux.sh {dest_dir} {wheel}
- uses: actions/upload-artifact@v3
with:
Expand Down
6 changes: 6 additions & 0 deletions scripts/repair_ci_wheel_linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dest_dir=$1
wheel=$2
auditwheel repair -w ${dest_dir} ${wheel}
wheel unpack --dest ${dest_dir} ${dest_dir}/*.whl
cp /usr/local/include/{gmp,mpfr,mpc}.h ${dest_dir}/gmpy2-*/gmpy2/
(cd ${dest_dir} && wheel pack gmpy2-*[0-9])
21 changes: 14 additions & 7 deletions test_cython/setup_cython.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
from setuptools import Extension, setup
from Cython.Build import cythonize
import platform
import sys
import os
import platform
import gmpy2

ON_WINDOWS = platform.system() == 'Windows'
gmpy2_packagedir = os.path.dirname(gmpy2.__file__)
library_dirs = sys.path + [gmpy2_packagedir]
libnames = ['mpc','mpfr','gmp']

if platform.system() == 'Linux':
bundled_libs = gmpy2_packagedir+'/../gmpy2.libs/'
if os.path.isdir(bundled_libs):
library_dirs += [bundled_libs]
libnames = [':' + d for d in os.listdir(bundled_libs)]


extensions = [
Extension("test_cython", ["test_cython.pyx"],
include_dirs=sys.path + ([os.path.dirname(gmpy2.__file__)] if ON_WINDOWS else []),
library_dirs=sys.path + ([os.path.dirname(gmpy2.__file__)] if ON_WINDOWS else []),
libraries=['mpc','mpfr','gmp']
)
]
include_dirs=sys.path + [gmpy2_packagedir],
library_dirs=library_dirs,
libraries=libnames)]

setup(
name="cython_gmpy_test",
Expand Down
1 change: 0 additions & 1 deletion test_cython/test_cython.pyx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# distutils: libraries = gmp mpfr mpc
from gmpy2 cimport *

import_gmpy2()
Expand Down

0 comments on commit 3c86ae8

Please sign in to comment.