|
60 | 60 |
|
61 | 61 | from queue import Queue
|
62 | 62 | from subprocess import CalledProcessError, check_call
|
63 |
| -from typing import (cast, Dict, Iterable, IO, List, NamedTuple, Tuple, |
64 |
| - TYPE_CHECKING) |
| 63 | +from typing import (cast, Dict, Iterable, IO, List, NamedTuple, Optional, |
| 64 | + Tuple, TYPE_CHECKING) |
65 | 65 |
|
66 | 66 |
|
67 | 67 | ###############################################################################
|
@@ -93,13 +93,15 @@ def stdout(message: str):
|
93 | 93 |
|
94 | 94 | # Find Clang for static analysis.
|
95 | 95 | if 'CC' in os.environ:
|
96 |
| - CLANG = os.environ['CC'] |
| 96 | + cc_candidate: Optional[str] = os.environ['CC'] |
97 | 97 | else:
|
98 |
| - CLANG = SATestUtils.which("clang", os.environ['PATH']) |
99 |
| -if not CLANG: |
| 98 | + cc_candidate = SATestUtils.which("clang", os.environ['PATH']) |
| 99 | +if not cc_candidate: |
100 | 100 | stderr("Error: cannot find 'clang' in PATH")
|
101 | 101 | sys.exit(1)
|
102 | 102 |
|
| 103 | +CLANG = cc_candidate |
| 104 | + |
103 | 105 | # Number of jobs.
|
104 | 106 | MAX_JOBS = int(math.ceil(multiprocessing.cpu_count() * 0.75))
|
105 | 107 |
|
@@ -204,8 +206,9 @@ def run_cleanup_script(directory: str, build_log_file: IO):
|
204 | 206 | cwd = os.path.join(directory, PATCHED_SOURCE_DIR_NAME)
|
205 | 207 | script_path = os.path.join(directory, CLEANUP_SCRIPT)
|
206 | 208 |
|
207 |
| - SATestUtils.runScript(script_path, build_log_file, cwd, |
208 |
| - Stdout=LOCAL.stdout, Stderr=LOCAL.stderr) |
| 209 | + SATestUtils.run_script(script_path, build_log_file, cwd, |
| 210 | + out=LOCAL.stdout, err=LOCAL.stderr, |
| 211 | + verbose=VERBOSE) |
209 | 212 |
|
210 | 213 |
|
211 | 214 | def download_and_patch(directory: str, build_log_file: IO):
|
@@ -238,8 +241,9 @@ def download(directory: str, build_log_file: IO):
|
238 | 241 | Run the script to download the project, if it exists.
|
239 | 242 | """
|
240 | 243 | script_path = os.path.join(directory, DOWNLOAD_SCRIPT)
|
241 |
| - SATestUtils.runScript(script_path, build_log_file, directory, |
242 |
| - Stdout=LOCAL.stdout, Stderr=LOCAL.stderr) |
| 244 | + SATestUtils.run_script(script_path, build_log_file, directory, |
| 245 | + out=LOCAL.stdout, err=LOCAL.stderr, |
| 246 | + verbose=VERBOSE) |
243 | 247 |
|
244 | 248 |
|
245 | 249 | def apply_patch(directory: str, build_log_file: IO):
|
@@ -557,9 +561,9 @@ def analyze_preprocessed(self, directory: str, output_dir: str):
|
557 | 561 | failed = False
|
558 | 562 |
|
559 | 563 | # Only run the analyzes on supported files.
|
560 |
| - if SATestUtils.hasNoExtension(file_name): |
| 564 | + if SATestUtils.has_no_extension(file_name): |
561 | 565 | continue
|
562 |
| - if not SATestUtils.isValidSingleInputFile(file_name): |
| 566 | + if not SATestUtils.is_valid_single_input_file(file_name): |
563 | 567 | stderr(f"Error: Invalid single input file {full_file_name}.\n")
|
564 | 568 | raise Exception()
|
565 | 569 |
|
@@ -859,7 +863,7 @@ def get_projects(map_file: IO) -> Iterable[Tuple[str, str]]:
|
859 | 863 | map_file.seek(0)
|
860 | 864 | # TODO: csv format is not very readable, change it to JSON
|
861 | 865 | for project_info in csv.reader(map_file):
|
862 |
| - if (SATestUtils.isCommentCSVLine(project_info)): |
| 866 | + if SATestUtils.is_comment_csv_line(project_info): |
863 | 867 | continue
|
864 | 868 | # suppress mypy error
|
865 | 869 | yield cast(Tuple[str, str], project_info)
|
|
0 commit comments