mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 07:53:34 +08:00
use CmakeLists scope to generate te XML file
- the only difference really is, that scope (the configuration.cmake) is already passed to px_process_params via the argument --scope. The Paths in --scope are evaluated w.r.t the path to src provided via the -s /--src-path argument. - if no --scope is proveided. the Old scheme by simply walking the full --src-path directory is applied
This commit is contained in:
@@ -50,7 +50,10 @@ from __future__ import print_function
|
||||
import sys
|
||||
import os
|
||||
import argparse
|
||||
from px4params import srcscanner, srcparser, xmlout, dokuwikiout, dokuwikirpc
|
||||
from px4params import srcscanner, srcparser, xmlout, dokuwikiout, dokuwikirpc, scope, cmakeparser
|
||||
|
||||
import re
|
||||
import codecs
|
||||
|
||||
def main():
|
||||
# Parse command line arguments
|
||||
@@ -108,6 +111,8 @@ def main():
|
||||
default="Automagically updated parameter documentation from code.",
|
||||
help="DokuWiki page edit summary")
|
||||
parser.add_argument('-v', '--verbose', action='store_true', help="verbose output")
|
||||
parser.add_argument('--scope', default=None, action='store', help="pass the scope (list of compiled modules)")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
# Check for valid command
|
||||
@@ -122,8 +127,28 @@ def main():
|
||||
|
||||
# Scan directories, and parse the files
|
||||
if (args.verbose): print("Scanning source path " + args.src_path)
|
||||
if not scanner.ScanDir(args.src_path, parser):
|
||||
sys.exit(1)
|
||||
|
||||
use_scope = False
|
||||
cmake_scope = scope.Scope();
|
||||
|
||||
if args.scope:
|
||||
with codecs.open(args.scope, 'r', 'utf-8') as f:
|
||||
try:
|
||||
contents = f.read()
|
||||
f.close()
|
||||
cmake_parser = cmakeparser.CMakeParser()
|
||||
cmake_parser.Parse(cmake_scope, contents)
|
||||
use_scope = True
|
||||
except:
|
||||
use_scope = False
|
||||
pass
|
||||
if use_scope:
|
||||
print(cmake_scope.scope)
|
||||
if not scanner.ScanDir([os.path.join(args.src_path, p) for p in cmake_scope.scope], parser):
|
||||
sys.exit(1)
|
||||
else:
|
||||
if not scanner.ScanDir([args.src_path], parser):
|
||||
sys.exit(1)
|
||||
if not parser.Validate():
|
||||
sys.exit(1)
|
||||
param_groups = parser.GetParamGroups()
|
||||
|
||||
Reference in New Issue
Block a user