diff options
author | Suren A. Chilingaryan <csa@suren.me> | 2016-03-06 02:42:09 +0100 |
---|---|---|
committer | Suren A. Chilingaryan <csa@suren.me> | 2016-03-06 02:42:09 +0100 |
commit | 0dce5c26ecec594b3f25b9e003c830874a690e1c (patch) | |
tree | 9909c8e8674723758d98b98e9b84e9c610562375 /cmake | |
parent | 43029f91d06a76fc38b85e283d368c1d06fcbc61 (diff) | |
download | pcitool-0dce5c26ecec594b3f25b9e003c830874a690e1c.tar.gz pcitool-0dce5c26ecec594b3f25b9e003c830874a690e1c.tar.bz2 pcitool-0dce5c26ecec594b3f25b9e003c830874a690e1c.tar.xz pcitool-0dce5c26ecec594b3f25b9e003c830874a690e1c.zip |
Clean-up python files during the clean and do not delete driver Makefile while packaging
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/tools.cmake | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/cmake/tools.cmake b/cmake/tools.cmake new file mode 100644 index 0000000..3526dba --- /dev/null +++ b/cmake/tools.cmake @@ -0,0 +1,15 @@ +MACRO(PYTHON_CLEAN_LIST PYPATH RESULT) + file(GLOB_RECURSE PYTHON_FILES "${PYPATH}/*.py") + + set(CLEAN_LIST "") + set(PYTHON_DIRS "") + foreach(ITEM ${PYTHON_FILES}) + get_filename_component(DIR ${ITEM} PATH) # Later version may require to use DIRECTORY instead of PATH + list(APPEND PYTHON_DIRS "${DIR}/__pycache__") + list(APPEND CLEAN_LIST "${ITEM}c") + endforeach(ITEM ${PYTHON_FILES}) + list(REMOVE_DUPLICATES PYTHON_DIRS) + list(APPEND CLEAN_LIST ${PYTHON_DIRS}) + + set(${RESULT} ${CLEAN_LIST}) +ENDMACRO(PYTHON_CLEAN_LIST PYPATH CLEAN_LIST) |