Tools/px4moduledoc: add some comments, describe the regexes

This commit is contained in:
Beat Küng
2017-05-16 10:05:14 +02:00
parent 8a83fb7dc2
commit 8b64fc8a5e
5 changed files with 15 additions and 4 deletions

View File

@@ -34,6 +34,9 @@ class SourceScanner(object):
Scans provided file and passes its contents to the parser using
parser.Parse method.
"""
# Extract the scope: it is the directory within the repo. Either it
# starts directly with 'src/module/abc', or it has the form 'x/y/z/src/module/abc'.
# The output is 'module/abc' in both cases.
prefix = "^(|.*" + os.path.sep + ")src" + os.path.sep
scope = re.sub(prefix.replace("\\", "/"), "", os.path.dirname(os.path.relpath(path)).replace("\\", "/"))