77
88@invoke .task
99def clean (c ):
10- """ Remove any built objects. """
10+ """ Remove any built objects """
1111 for pattern in ["*.o" , "*.so" , "cffi_example* cython_wrapper.cpp" , ]:
1212 c .run ("rm -rf {}" .format (pattern ))
1313
@@ -17,7 +17,7 @@ def print_banner(msg):
1717
1818@invoke .task
1919def build_cmult (c ):
20- """ Compile and link the shared library (DLL) for the sample C++ code. """
20+ """ Build the shared library for the sample C code """
2121 print_banner ("Building C Library" )
2222 invoke .run ("gcc -c -Wall -Werror -fpic cmult.c -I /usr/include/python3.7" )
2323 invoke .run ("gcc -shared -o libcmult.so cmult.o" )
@@ -26,11 +26,13 @@ def build_cmult(c):
2626
2727@invoke .task (build_cmult )
2828def test_ctypes (c ):
29+ """ Run the script to test ctypes """
2930 print_banner ("Testing ctypes Module" )
3031 invoke .run ("python3 ctypes_test.py" , pty = True )
3132
3233@invoke .task (build_cmult )
3334def build_cffi (c ):
35+ """ Build the CFFI Python bindings """
3436 print_banner ("Building CFFI Module" )
3537 ffi = cffi .FFI ()
3638
@@ -57,13 +59,14 @@ def build_cffi(c):
5759
5860@invoke .task ()
5961def test_cffi (c ):
62+ """ Run the script to test CFFI """
6063 print_banner ("Testing CFFI Module" )
6164 invoke .run ("python3 cffi_test.py" , pty = True )
6265
6366
6467@invoke .task ()
6568def build_cppmult (c ):
66- """ Compile and link the shared library (DLL) for the sample C++ code. """
69+ """ Build the shared library for the sample C++ code """
6770 print_banner ("Building C++ Library" )
6871 invoke .run (
6972 "g++ -O3 -Wall -Werror -shared -std=c++11 -fPIC cppmult.cpp -o libcppmult.so "
@@ -81,35 +84,38 @@ def compile_python_module(cpp_name, extension_name):
8184
8285@invoke .task (build_cppmult )
8386def build_pybind11 (c ):
84- """ compile and link the pybind11 wrapper library """
87+ """ Build the pybind11 wrapper library """
8588 print_banner ("Building PyBind11 Module" )
8689 compile_python_module ("pybind11_wrapper.cpp" , "pybind11_example" )
8790 print ("* Complete" )
8891
8992@invoke .task ()
9093def test_pybind11 (c ):
94+ """ Run the script to test PyBind11 """
9195 print_banner ("Testing PyBind11 Module" )
9296 invoke .run ("python3 pybind11_test.py" , pty = True )
9397
9498
9599@invoke .task (build_cppmult )
96100def build_cython (c ):
97- """ build the cython extension module """
101+ """ Build the cython extension module """
98102 print_banner ("Building Cython Module" )
99- # run cython on the pyx file to create a .cpp file
103+ # Run cython on the pyx file to create a .cpp file
100104 invoke .run ("cython --cplus -3 cython_example.pyx -o cython_wrapper.cpp" )
101105
102- # compile and link the cython wrapper library
106+ # Compile and link the cython wrapper library
103107 compile_python_module ("cython_wrapper.cpp" , "cython_example" )
104108 print ("* Complete" )
105109
106110@invoke .task ()
107111def test_cython (c ):
112+ """ Run the script to test Cython """
108113 print_banner ("Testing Cython Module" )
109114 invoke .run ("python3 cython_test.py" , pty = True )
110115
111116@invoke .task (clean , build_cmult , test_ctypes , build_cffi , test_cffi ,
112117 build_pybind11 , test_pybind11 , build_cython , test_cython )
113118def all (c ):
119+ """ Build and run all tests """
114120 pass
115121
0 commit comments