Skip to content

Commit 10dd1bd

Browse files
authored
Python bindings (#328)
* Include .o files * Add some missing prerequisites
1 parent 09239e7 commit 10dd1bd

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ __pycache__/
88

99
# C extensions
1010
*.so
11+
*.o
1112

1213
# Distribution / packaging
1314
.Python

python-bindings/tasks.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def build_cmult(c, path=None):
5757
c.run(path)
5858
else:
5959
print_banner("Building C Library")
60-
cmd = "gcc -c -Wall -Werror -fpic cmult.c -I /usr/include/python3.7"
60+
cmd = "gcc -c -Wall -Werror -fpic cmult.c"
6161
invoke.run(cmd)
6262
invoke.run("gcc -shared -o libcmult.so cmult.o")
6363
print("* Complete")
@@ -85,7 +85,7 @@ def test_ctypes_cpp(c):
8585
invoke.run("python3 ctypes_cpp_test.py", pty=True)
8686

8787

88-
@invoke.task()
88+
@invoke.task(build_cmult)
8989
def build_cffi(c):
9090
"""Build the CFFI Python bindings"""
9191
print_banner("Building CFFI Module")
@@ -118,7 +118,7 @@ def build_cffi(c):
118118
print("* Complete")
119119

120120

121-
@invoke.task()
121+
@invoke.task(build_cffi)
122122
def test_cffi(c):
123123
"""Run the script to test CFFI"""
124124
print_banner("Testing CFFI Module")
@@ -140,9 +140,9 @@ def compile_python_module(cpp_name, extension_name):
140140
invoke.run(
141141
"g++ -O3 -Wall -Werror -shared -std=c++11 -fPIC "
142142
"`python3 -m pybind11 --includes` "
143-
"-I /usr/include/python3.7 -I . "
143+
"-I . "
144144
"{0} "
145-
"-o {1}`python3.7-config --extension-suffix` "
145+
"-o {1}`python3-config --extension-suffix` "
146146
"-L. -lcppmult -Wl,-rpath,.".format(cpp_name, extension_name)
147147
)
148148

@@ -155,7 +155,7 @@ def build_pybind11(c):
155155
print("* Complete")
156156

157157

158-
@invoke.task()
158+
@invoke.task(build_pybind11)
159159
def test_pybind11(c):
160160
"""Run the script to test PyBind11"""
161161
print_banner("Testing PyBind11 Module")
@@ -174,7 +174,7 @@ def build_cython(c):
174174
print("* Complete")
175175

176176

177-
@invoke.task()
177+
@invoke.task(build_cython)
178178
def test_cython(c):
179179
"""Run the script to test Cython"""
180180
print_banner("Testing Cython Module")

0 commit comments

Comments
 (0)