aboutsummaryrefslogtreecommitdiffstats
path: root/klippy
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2021-02-07 20:48:21 -0500
committerKevin O'Connor <kevin@koconnor.net>2021-02-07 20:48:21 -0500
commit1049282eec1eb1717df6ac49c0e533bb034e1961 (patch)
treedd60537eef6269d648090507ad87e41673fe55ae /klippy
parenta7b50b6002d2982c6b426f180a5f6bf9db976e1f (diff)
downloadkutter-1049282eec1eb1717df6ac49c0e533bb034e1961.tar.gz
kutter-1049282eec1eb1717df6ac49c0e533bb034e1961.tar.xz
kutter-1049282eec1eb1717df6ac49c0e533bb034e1961.zip
chelper: Fix check for failed code build
Commit 73b78af6 inadvertently removed the check for a successful gcc compilation. Add the check back in. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy')
-rw-r--r--klippy/chelper/__init__.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/klippy/chelper/__init__.py b/klippy/chelper/__init__.py
index ed2ae457..d373d72e 100644
--- a/klippy/chelper/__init__.py
+++ b/klippy/chelper/__init__.py
@@ -199,12 +199,21 @@ def check_build_code(sources, target):
obj_times = get_mtimes([target])
return not obj_times or max(src_times) > min(obj_times)
+# Check if the current gcc version supports a particular command-line option
def check_gcc_option(option):
cmd = "%s %s -S -o /dev/null -xc /dev/null > /dev/null 2>&1" % (
GCC_CMD, option)
res = os.system(cmd)
return res == 0
+# Check if the current gcc version supports a particular command-line option
+def do_build_code(cmd):
+ res = os.system(cmd)
+ if res:
+ msg = "Unable to build C code module (error=%s)" % (res,)
+ logging.error(msg)
+ raise Exception(msg)
+
FFI_main = None
FFI_lib = None
pyhelper_logging_callback = None
@@ -223,7 +232,7 @@ def get_ffi():
else:
cmd = "%s %s" % (GCC_CMD, COMPILE_ARGS)
logging.info("Building C code module %s", DEST_LIB)
- os.system(cmd % (destlib, ' '.join(srcfiles)))
+ do_build_code(cmd % (destlib, ' '.join(srcfiles)))
FFI_main = cffi.FFI()
for d in defs_all:
FFI_main.cdef(d)
@@ -254,7 +263,7 @@ def run_hub_ctrl(enable_power):
destlib = get_abs_files(hubdir, [HC_TARGET])[0]
if check_build_code(srcfiles, destlib):
logging.info("Building C code module %s", HC_TARGET)
- os.system(HC_COMPILE_CMD % (destlib, ' '.join(srcfiles)))
+ do_build_code(HC_COMPILE_CMD % (destlib, ' '.join(srcfiles)))
os.system(HC_CMD % (hubdir, enable_power))