From 277786ded828d87d2213d33ec985fdacf5fd7328 Mon Sep 17 00:00:00 2001 From: karl-police Date: Mon, 2 Oct 2023 20:40:56 +0200 Subject: [PATCH 1/3] Add a function to add multiple files from one folder --- core/AMBuilder | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/core/AMBuilder b/core/AMBuilder index 6e16a480..75cc62e7 100644 --- a/core/AMBuilder +++ b/core/AMBuilder @@ -1,6 +1,23 @@ # vim: set sts=2 ts=8 sw=2 tw=99 et ft=python: import os +# Function to add multiple files from one folder +# e.g. in binary.sources adding *addFromFolder to unpack the list. +def addFromFolder(path, extension=".cpp", recursive=False): + fileSelection = [] + + for root, dirs, files in os.walk(path): + for file in files: + if file.endswith(extension): + fileSelection.append( os.path.join(root, file) ) + + if not recursive: + break # no recursive + + print(fileSelection) + return fileSelection + + for sdk_name in MMS.sdks: for cxx in MMS.all_targets: sdk = MMS.sdks[sdk_name] From bf51b02f79e556ff1c2827c144a7dd6d8d08ef7e Mon Sep 17 00:00:00 2001 From: karl-police Date: Mon, 2 Oct 2023 20:52:46 +0200 Subject: [PATCH 2/3] Update AMBuilder --- core/AMBuilder | 1 - 1 file changed, 1 deletion(-) diff --git a/core/AMBuilder b/core/AMBuilder index 75cc62e7..13433cf9 100644 --- a/core/AMBuilder +++ b/core/AMBuilder @@ -14,7 +14,6 @@ def addFromFolder(path, extension=".cpp", recursive=False): if not recursive: break # no recursive - print(fileSelection) return fileSelection From ec802bc76bf216e77e53ef79e09a51d0006152bf Mon Sep 17 00:00:00 2001 From: karl-police Date: Mon, 2 Oct 2023 22:16:29 +0200 Subject: [PATCH 3/3] Update AMBuilder --- core/AMBuilder | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/AMBuilder b/core/AMBuilder index 13433cf9..caa8c32f 100644 --- a/core/AMBuilder +++ b/core/AMBuilder @@ -16,6 +16,15 @@ def addFromFolder(path, extension=".cpp", recursive=False): return fileSelection +def getFolders(base_folder, recursive=True): + folder_list = [] + for root, dirs, files in os.walk(base_folder): + if recursive: + folder_list.extend([os.path.join(root, folder) for folder in dirs]) + else: + folder_list.extend([os.path.join(root, folder) for folder in dirs]) + break # no recursive + return folder_list for sdk_name in MMS.sdks: for cxx in MMS.all_targets: