rebuild cython extensions when python/cython/distuils change

master
Adeeb Shihadeh 2020-07-16 13:36:28 -07:00
parent 2265c9c3dc
commit 9ee0069ecc
3 changed files with 11 additions and 6 deletions

1
.gitignore vendored
View File

@ -14,4 +14,3 @@ can/packer_pyx.cpp
can/parser_pyx.cpp
can/packer_pyx.html
can/parser_pyx.html
can/packer_impl.cpp

View File

@ -1,9 +1,16 @@
import Cython
import distutils
import os
import subprocess
import sys
zmq = 'zmq'
arch = subprocess.check_output(["uname", "-m"], encoding='utf8').rstrip()
# Rebuild cython extensions if python, distutils, or cython change
cython_dependencies = [Value(v) for v in (sys.version, distutils.__version__, Cython.__version__)]
Export('cython_dependencies')
cereal_dir = Dir('.')
cpppath = [

View File

@ -1,4 +1,4 @@
Import('env', 'cereal')
Import('env', 'cereal', 'cython_dependencies')
import os
from opendbc.can.process_dbc import process
@ -17,7 +17,6 @@ for x in sorted(os.listdir('../')):
libdbc = env.SharedLibrary('libdbc', ["dbc.cc", "parser.cc", "packer.cc", "common.cc"]+dbcs, LIBS=["capnp", "kj"])
# Build packer and parser
env.Command(['packer_pyx.so', 'parser_pyx.so'],
[libdbc, cereal, 'common_pyx_setup.py', 'packer_pyx.pyx', 'parser_pyx.pyx', 'common.pxd'],
"cd opendbc/can && python3 common_pyx_setup.py build_ext --inplace")
env.Command(['packer_pyx.so', 'packer_pyx.cpp', 'parser_pyx.so', 'parser_pyx.cpp'],
cython_dependencies + [libdbc, cereal, 'common_pyx_setup.py', 'common.pxd', 'packer_pyx.pyx', 'parser_pyx.pyx'],
"cd opendbc/can && python3 common_pyx_setup.py build_ext --inplace")