Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Ardupilot
GitHub Repository: Ardupilot/ardupilot
Path: blob/master/Tools/scripts/build_examples.py
9377 views
1
#!/usr/bin/env python3
2
3
from __future__ import annotations
4
5
# useful script to test the build of all example code
6
# This helps when doing large merges
7
# Peter Barker, June 2016
8
# based on build_examples.sh, Andrew Tridgell, November 2012
9
10
# AP_FLAKE8_CLEAN
11
12
import os
13
import sys
14
import optparse
15
16
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), '../autotest/pysim'))
17
18
import util # NOQA
19
20
21
class BuildExamples():
22
def __init__(self, targets: list | None = None, clean=False):
23
print("init")
24
if targets is None:
25
targets = []
26
self.targets = targets
27
self.clean = clean
28
29
def run(self):
30
for target in self.targets:
31
util.build_examples(target, clean=self.clean)
32
33
34
if __name__ == '__main__':
35
36
parser = optparse.OptionParser("build_examples.py")
37
parser.add_option(
38
"--target",
39
type='string',
40
default=['navio', 'Pixhawk1'],
41
help='list of targets for which to build examples', action='append'
42
)
43
parser.add_option("--clean", action='store_true', default=False, help='clean build')
44
opts, args = parser.parse_args()
45
46
buildexamples = BuildExamples(targets=opts.target, clean=opts.clean)
47
buildexamples.run()
48
49