2016-06-01 04:11:44 -03:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
# useful script to test the build of all example code
|
|
|
|
# This helps when doing large merges
|
|
|
|
# Peter Barker, June 2016
|
|
|
|
# based on build_examples.sh, Andrew Tridgell, November 2012
|
|
|
|
|
2021-06-21 23:52:55 -03:00
|
|
|
# AP_FLAKE8_CLEAN
|
|
|
|
|
2016-06-01 04:11:44 -03:00
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
import optparse
|
|
|
|
|
|
|
|
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), '../autotest/pysim'))
|
|
|
|
|
2021-06-21 23:52:55 -03:00
|
|
|
import util # NOQA
|
|
|
|
|
2016-06-01 04:11:44 -03:00
|
|
|
|
|
|
|
class BuildExamples():
|
|
|
|
def __init__(self, targets=[], clean=False):
|
|
|
|
print("init")
|
|
|
|
self.targets = targets
|
|
|
|
self.clean = clean
|
|
|
|
|
|
|
|
def run(self):
|
|
|
|
for target in self.targets:
|
|
|
|
util.build_examples(target, clean=self.clean)
|
|
|
|
|
2021-06-21 23:52:55 -03:00
|
|
|
|
2016-06-01 04:11:44 -03:00
|
|
|
if __name__ == '__main__':
|
|
|
|
|
|
|
|
parser = optparse.OptionParser("build_examples.py")
|
2021-06-21 23:52:55 -03:00
|
|
|
parser.add_option(
|
|
|
|
"--target",
|
|
|
|
type='string',
|
|
|
|
default=['navio', 'Pixhawk1'],
|
|
|
|
help='list of targets for which to build examples', action='append'
|
|
|
|
)
|
2016-06-01 04:11:44 -03:00
|
|
|
parser.add_option("--clean", action='store_true', default=False, help='clean build')
|
|
|
|
opts, args = parser.parse_args()
|
|
|
|
|
|
|
|
buildexamples = BuildExamples(targets=opts.target, clean=opts.clean)
|
|
|
|
buildexamples.run()
|