From 5f9b55469acc12c60f6bead7bd844f9ba1e37ff5 Mon Sep 17 00:00:00 2001 From: carlosuc3m <100329787@alumnos.uc3m.es> Date: Wed, 13 Nov 2024 15:24:20 +0100 Subject: [PATCH] use absolute path and correct errors with spaces in macros --- .github/create_macro.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/create_macro.py b/.github/create_macro.py index 94a6f201..5575ac0c 100644 --- a/.github/create_macro.py +++ b/.github/create_macro.py @@ -39,6 +39,7 @@ def is_model_supported_on_os(descriptor): modelWeights = descriptor.getWeights().gettAllSupportedWeightObjects() for ww in modelWeights: + print(ww.getFramework(), ww.getTrainingVersion()) isAvailable = AvailableEngines.isEngineSupportedInOS(ww.getFramework(), ww.getTrainingVersion(), None, None) if isAvailable: return True @@ -90,7 +91,7 @@ def parse_model_paths(models): for model in model_nicknames: print("Downloading the Bioimage.io model: " + model.strip()) model_dir = br.downloadModelByID(model.strip(), models_dir) - models_full_path.append(model_dir) + models_full_path.append(os.path.abspath(model_dir)) ## Create macros @@ -109,7 +110,10 @@ def parse_model_paths(models): continue convert_npy_to_tif(mfp, test_name, descriptor.getInputTensors().get(0).getAxesOrder()) sample_name = CREATED_SAMPLE_NAME - macro = MACRO_STR.format(model_path=mfp, input_path=os.path.join(mfp, sample_name), output_folder=mfp) + if mfp.contains(" "): + macro = MACRO_STR.format(model_path="[" + mfp + "]", input_path="[" + os.path.join(mfp, sample_name) + "]", output_folder="[" + mfp + "]") + else: + macro = MACRO_STR.format(model_path=mfp, input_path=os.path.join(mfp, sample_name), output_folder=mfp) file.write(macro + os.linesep) name_without_extension = sample_name[:sample_name.rfind(".")]