usermods/*/setup_deps.py: Check lib_deps for deps
Check the safest possible location for final information on what components are actually being linked in. This demonstrates a safe approach that works even for out-of-tree modules.
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
from platformio.package.meta import PackageSpec
|
||||
Import('env')
|
||||
|
||||
|
||||
usermods = env.GetProjectOption("custom_usermods","").split()
|
||||
libs = [PackageSpec(lib).name for lib in env.GetProjectOption("lib_deps",[])]
|
||||
# Check for dependencies
|
||||
if "Temperature" in usermods:
|
||||
if "Temperature" in libs:
|
||||
env.Append(CPPDEFINES=[("USERMOD_DALLASTEMPERATURE")])
|
||||
elif "sht" in usermods:
|
||||
elif "sht" in libs:
|
||||
env.Append(CPPDEFINES=[("USERMOD_SHT")])
|
||||
elif "PWM_fan" in usermods: # The script can be run if this module was previously selected
|
||||
elif "PWM_fan" in libs: # The script can be run if this module was previously selected
|
||||
raise RuntimeError("PWM_fan usermod requires Temperature or sht to be enabled")
|
||||
|
||||
Reference in New Issue
Block a user