diff options
Diffstat (limited to 'scripts/spi_flash/fatfs_lib.py')
-rw-r--r-- | scripts/spi_flash/fatfs_lib.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/scripts/spi_flash/fatfs_lib.py b/scripts/spi_flash/fatfs_lib.py index ef92070a..6ad37e66 100644 --- a/scripts/spi_flash/fatfs_lib.py +++ b/scripts/spi_flash/fatfs_lib.py @@ -5,8 +5,8 @@ # This file may be distributed under the terms of the GNU GPLv3 license. import os import sys -KLIPPER_DIR = os.path.abspath(os.path.join( - os.path.dirname(__file__), "../../")) + +KLIPPER_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../")) sys.path.append(os.path.join(KLIPPER_DIR, "klippy")) import chelper @@ -58,6 +58,7 @@ FATFS_CDEFS = """ fatfs_ffi_main = None fatfs_ffi_lib = None + def check_fatfs_build(printfunc=lambda o: o): printfunc("Checking FatFS CFFI Build...\n") ffi_main, ffi_lib = chelper.get_ffi() @@ -67,20 +68,24 @@ def check_fatfs_build(printfunc=lambda o: o): ofiles = chelper.get_abs_files(FATFS_DIR, FATFS_HEADERS) ofiles.extend(chelper.get_abs_files(srcdir, SPI_FLASH_HEADERS)) destlib = os.path.join(srcdir, DEST_LIB) - if chelper.check_build_code(srcfiles+ofiles+[__file__], destlib): + if chelper.check_build_code(srcfiles + ofiles + [__file__], destlib): if chelper.check_gcc_option(chelper.SSE_FLAGS): - cmd = "%s %s %s" % (chelper.GCC_CMD, chelper.SSE_FLAGS, - chelper.COMPILE_ARGS) + cmd = "%s %s %s" % ( + chelper.GCC_CMD, + chelper.SSE_FLAGS, + chelper.COMPILE_ARGS, + ) else: cmd = "%s %s" % (chelper.GCC_CMD, chelper.COMPILE_ARGS) printfunc("Building FatFS shared library...") - chelper.do_build_code(cmd % (destlib, ' '.join(srcfiles))) + chelper.do_build_code(cmd % (destlib, " ".join(srcfiles))) printfunc("Done\n") global fatfs_ffi_main, fatfs_ffi_lib ffi_main.cdef(FATFS_CDEFS) fatfs_ffi_lib = ffi_main.dlopen(destlib) fatfs_ffi_main = ffi_main + def get_fatfs_ffi(): global fatfs_ffi_main, fatfs_ffi_lib if fatfs_ffi_main is None: |