2022-05-15 23:27:30 +02:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
import os
|
|
|
|
import subprocess
|
|
|
|
|
|
|
|
# execute './switchconf.sh --list' to get the list of available configurations
|
|
|
|
output = subprocess.check_output(['bash', './switchconf.sh', '--list']).decode('utf-8').splitlines()
|
|
|
|
|
2022-05-15 23:31:08 +02:00
|
|
|
# read symlink './sdkconfig' to get the current configuration
|
2022-05-30 15:39:02 +02:00
|
|
|
current_config = os.readlink('./sdkconfig').split('sdkconfig_')[1]
|
2022-05-15 23:31:08 +02:00
|
|
|
|
2022-05-15 23:27:30 +02:00
|
|
|
if len(output) == 0:
|
|
|
|
print('No configurations found!')
|
|
|
|
exit(1)
|
|
|
|
|
|
|
|
# check if PATH (env) contains 'bobbycar-boardcomputer-firmware
|
|
|
|
if 'bobbycar-boardcomputer-firmware' not in os.environ['PATH']:
|
|
|
|
print('Please execute ". export.sh"')
|
|
|
|
exit(1)
|
|
|
|
|
|
|
|
for config in output:
|
|
|
|
print('Switching to configuration: ' + config)
|
|
|
|
subprocess.check_call(['bash', './switchconf.sh', config])
|
|
|
|
# execute idf.py menuconfig and wait for user to close again
|
2022-05-15 23:31:08 +02:00
|
|
|
subprocess.check_call(['idf.py', 'menuconfig'])
|
|
|
|
|
|
|
|
# switch back to current configuration
|
|
|
|
print('Switching back to configuration: ' + current_config)
|
2022-05-30 15:39:02 +02:00
|
|
|
subprocess.check_call(['bash', './switchconf.sh', current_config])
|