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>
diff --git a/tests/scripts/check_files.py b/tests/scripts/check_files.py
index a0f5e1f..5c18702 100755
--- a/tests/scripts/check_files.py
+++ b/tests/scripts/check_files.py
@@ -34,6 +34,9 @@
except ImportError:
pass
+import scripts_path # pylint: disable=unused-import
+from mbedtls_dev import build_tree
+
class FileIssueTracker:
"""Base class for file-wide issue tracking.
@@ -338,7 +341,7 @@
"""Instantiate the sanity checker.
Check files under the current directory.
Write a report of issues to log_file."""
- self.check_repo_path()
+ build_tree.check_repo_path()
self.logger = None
self.setup_logger(log_file)
self.issues_to_check = [
@@ -353,11 +356,6 @@
MergeArtifactIssueTracker(),
]
- @staticmethod
- def check_repo_path():
- if not all(os.path.isdir(d) for d in ["include", "library", "tests"]):
- raise Exception("Must be run from Mbed TLS root")
-
def setup_logger(self, log_file, level=logging.INFO):
self.logger = logging.getLogger()
self.logger.setLevel(level)