Unify check_repo_path
We had 4 identical copies of the check_repo_path function. Replace them by a single copy in the build_tree module where it naturally belongs. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
15997bd389
commit
d9071e7d96
5 changed files with 23 additions and 28 deletions
|
@ -56,6 +56,10 @@ import shutil
|
|||
import subprocess
|
||||
import logging
|
||||
|
||||
import scripts_path # pylint: disable=unused-import
|
||||
from mbedtls_dev import build_tree
|
||||
|
||||
|
||||
# Naming patterns to check against. These are defined outside the NameCheck
|
||||
# class for ease of modification.
|
||||
PUBLIC_MACRO_PATTERN = r"^(MBEDTLS|PSA)_[0-9A-Z_]*[0-9A-Z]$"
|
||||
|
@ -219,7 +223,7 @@ class CodeParser():
|
|||
"""
|
||||
def __init__(self, log):
|
||||
self.log = log
|
||||
self.check_repo_path()
|
||||
build_tree.check_repo_path()
|
||||
|
||||
# Memo for storing "glob expression": set(filepaths)
|
||||
self.files = {}
|
||||
|
@ -228,15 +232,6 @@ class CodeParser():
|
|||
# Note that "*" can match directory separators in exclude lists.
|
||||
self.excluded_files = ["*/bn_mul", "*/compat-2.x.h"]
|
||||
|
||||
@staticmethod
|
||||
def check_repo_path():
|
||||
"""
|
||||
Check that the current working directory is the project root, and throw
|
||||
an exception if not.
|
||||
"""
|
||||
if not all(os.path.isdir(d) for d in ["include", "library", "tests"]):
|
||||
raise Exception("This script must be run from Mbed TLS root")
|
||||
|
||||
def comprehensive_parse(self):
|
||||
"""
|
||||
Comprehensive ("default") function to call each parsing function and
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue