forked from PX4/PX4-Autopilot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
1 parent
c72de87
commit 6fe9b8e
Showing
9 changed files
with
130 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__all__ = ["srcscanner", "srcparser", "xmlout", "dokuwikiout", "dokuwikirpc"] | ||
__all__ = ["srcscanner", "srcparser", "xmlout", "dokuwikiout", "dokuwikirpc", "cmakeparser", "scope"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import re | ||
import codecs | ||
import sys | ||
|
||
class CMakeParser(object): | ||
""" | ||
Parses provided data and stores all found paths in scope. | ||
""" | ||
re_split_lines = re.compile(r'[\r\n]+') | ||
re_comment = re.compile(r'^\#') | ||
re_start = re.compile(r'set\s*\(\s*config_module_list') | ||
re_end = re.compile(r'\)\s*') | ||
|
||
def Parse(self, scope, contents): | ||
""" | ||
Incrementally parse cmake file contents and append all found path scope | ||
to scope. | ||
""" | ||
# This code is essentially a comment-parsing grammar. "state" | ||
# represents parser state. It contains human-readable state | ||
# names. | ||
state = None | ||
for line in self.re_split_lines.split(contents): | ||
line = line.strip() | ||
# Ignore empty lines | ||
if line == "": | ||
continue | ||
if self.re_comment.match(line): | ||
continue | ||
elif self.re_start.match(line): | ||
state = "gather" | ||
continue | ||
elif state is not None and state == "gather": | ||
if self.re_end.match(line): | ||
return True | ||
scope.Add(line) | ||
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import os | ||
import re | ||
|
||
class Scope(object): | ||
""" | ||
Single parameter group | ||
""" | ||
re_deep_lines = re.compile(r'.*\/.*\/') | ||
def __init__(self,): | ||
self.scope = set() | ||
|
||
|
||
def __str__(self): | ||
return self.scope.__str__() | ||
|
||
def Add(self, scope): | ||
""" | ||
Add Scope to set | ||
""" | ||
self.scope.add(scope) | ||
|
||
def Has(self, scope): | ||
""" | ||
Check for existance | ||
""" | ||
if len(self.scope) == 0: | ||
return True | ||
# Anything in the form xxxxx/yyyyy/zzzzz.... | ||
# is treated as xxxxx/yyyyy | ||
while (self.re_deep_lines.match(scope)): | ||
scope = os.path.dirname(scope) | ||
return scope in self.scope |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters