aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRickard Bolin <rickard.bolin@arm.com>2022-05-24 07:43:03 +0000
committerRickard Bolin <rickard.bolin@arm.com>2022-05-24 10:17:02 +0000
commit9b8b4489558e41b4e5862bf3793cd089e3ad28f8 (patch)
treef9ae90421460329dd96e8cb3c8b258aa8d9cc34c
parentc3597d1176e0366c52e5b22c8325a724afab29e5 (diff)
downloadethos-u-vela-9b8b4489558e41b4e5862bf3793cd089e3ad28f8.tar.gz
MLBEDSW-6593: Issue with finding some config files
The argument to the lstrip function is a list of all characters that should be stripped from the beginning of the string, in any order. To remove the actual prefix, check if the string starts with the string instead and then remove that amount of characters. The function "removeprefix" was added in python3.9 which does exactly this, but that is not yet available to vela since it supports python 3.7. Signed-off-by: Rickard Bolin <rickard.bolin@arm.com> Change-Id: Ibc5a173c6d422cb5f55feb80caef6c5c30cf7d39
-rw-r--r--ethosu/vela/vela.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/ethosu/vela/vela.py b/ethosu/vela/vela.py
index 6207800..ee4de5d 100644
--- a/ethosu/vela/vela.py
+++ b/ethosu/vela/vela.py
@@ -287,9 +287,10 @@ def generate_supported_ops():
def list_config_files():
- print("\nAvailable config files:\n")
+ print("Available config files:")
+ path_length = len(CONFIG_FILES_PATH + os.path.sep)
for config in glob.glob(os.path.join(CONFIG_FILES_PATH, "*", "*.ini")):
- print(config.lstrip(CONFIG_FILES_PATH + os.path.sep))
+ print(config[path_length:])
def main(args=None):
@@ -470,11 +471,11 @@ def main(args=None):
config_path = os.path.join(CONFIG_FILES_PATH, config)
else:
print(
- f"Warning: Configuration file `{config}` not located in a folder directly under the "
- "`config_files` directory. Note that the file depth from the `config_files` directory must be "
- "exactly 2 to be discovered via the --list-config-files mechanism "
- "(e.g. `config_files/directory_name/my_config_file.ini`). This config file will still be "
- "parsed however, and treated as an absolute path config instead."
+ f"Warning: Configuration file `{config}` is either not located in a folder directly under the "
+ "`config_files` directory or has not been provided correctly. Note that the file depth from the "
+ "`config_files` directory must be exactly 2 to be discovered via the --list-config-files "
+ "mechanism (e.g. `directory_name/my_config_file.ini` located in the config_files directory). "
+ "This config file will still be parsed however, and treated as an absolute path config instead."
)
config_path = config