Improve Luos_engine build script display
import sys
import subprocess
-from os import system, listdir
+from os import system, listdir, path
from os.path import join, realpath
Import('env')
# install pyluos
try:
- from pyluos import version
- print("\nPyluos revision " + str(version.version) + " already installed.")
+ import pyluos
subprocess.check_call([sys.executable, "-m", "pip",
"install", "pyluos", "--upgrade", "--quiet"])
except ImportError: # module doesn't exist, deal with it.
subprocess.check_call([sys.executable, "-m", "pip", "install", "pyluos"])
pass
+print('\n\033[4mLuos engine build configuration:\033[0m\n')
+try:
+ from pyluos import version
+ print("\t*\033[0;32m Pyluos revision " +
+ str(version.version) + " ready.\033[0m")
+except ImportError: # module doesn't exist, deal with it.
+ print("\t*\033[0;32m Pyluos install failed. Platformio will be unable to use bootloader flash feature.\033[0m")
sources = ["+<*.c>",
"+<../../../Network/Robus/src/*.c>",
@@ -24,9 +30,15 @@ sources = ["+<*.c>",
"+<../../Bootloader/*.c>"]
# private library flags
+find_HAL = False
for item in env.get("CPPDEFINES", []):
if isinstance(item, tuple) and item[0] == "LUOSHAL":
- print("\nSelected HAL for Luos and Robus is : %s\n" % item[1])
+ find_HAL = True
+ if (path.exists("Network/Robus/HAL/" + item[1]) and path.exists("Engine/HAL/" + item[1])):
+ print(
+ "\t*\033[0;32m %s HAL selected for Luos and Robus.\033[0m\n" % item[1])
+ else:
+ print("\t*\033[1;31m %s HAL not found\033[0m\n" % item[1])
env.Append(CPPPATH=[realpath("Network/Robus/HAL/" + item[1])])
env.Append(CPPPATH=[realpath("Engine/HAL/" + item[1])])
env.Replace(SRC_FILTER=sources)
@@ -35,6 +47,9 @@ for item in env.get("CPPDEFINES", []):
env.Append(SRC_FILTER=["+<../../HAL/%s/*.c>" % item[1]])
break
+if (find_HAL == False):
+ print("\033[1;31mNo HAL selected. Please add a \033[0;30;47m-DLUOSHAL\033[0m\033[1;31m compilation flag\033[0m\n")
+
# native unit testing
if (env.get("PIOPLATFORM") == "native"):
for item in env.get("CPPDEFINES", []):
