diff --git a/infer/lib/python/inferTraceBugs b/infer/lib/python/inferTraceBugs index b87087401..6a95e0b65 100755 --- a/infer/lib/python/inferTraceBugs +++ b/infer/lib/python/inferTraceBugs @@ -21,7 +21,7 @@ import shutil import subprocess import sys -from inferlib import analyze, config, source, utils +from inferlib import config, source, utils HTML_REPORT_DIR = 'report.html' TRACES_REPORT_DIR = 'traces' @@ -346,10 +346,10 @@ def html_list_of_bugs(args, remote_source_template, selector): def generate_html_report(args, reports): html_dir = os.path.join(args.infer_out, HTML_REPORT_DIR) shutil.rmtree(html_dir, True) - analyze.mkdir_if_not_exists(html_dir) + utils.mkdir_if_not_exists(html_dir) traces_dir = os.path.join(html_dir, TRACES_REPORT_DIR) - analyze.mkdir_if_not_exists(traces_dir) + utils.mkdir_if_not_exists(traces_dir) sel = Selector(args, reports) diff --git a/infer/lib/python/inferlib/analyze.py b/infer/lib/python/inferlib/analyze.py index 98578a804..d521167ba 100644 --- a/infer/lib/python/inferlib/analyze.py +++ b/infer/lib/python/inferlib/analyze.py @@ -190,17 +190,11 @@ def remove_infer_out(infer_out): shutil.rmtree(infer_out, True) -def mkdir_if_not_exists(path): - try: - os.mkdir(path) - except OSError: - pass - def create_results_dir(results_dir): - mkdir_if_not_exists(results_dir) - mkdir_if_not_exists(os.path.join(results_dir, 'specs')) - mkdir_if_not_exists(os.path.join(results_dir, 'captured')) - mkdir_if_not_exists(os.path.join(results_dir, 'sources')) + utils.mkdir_if_not_exists(results_dir) + utils.mkdir_if_not_exists(os.path.join(results_dir, 'specs')) + utils.mkdir_if_not_exists(os.path.join(results_dir, 'captured')) + utils.mkdir_if_not_exists(os.path.join(results_dir, 'sources')) def clean(infer_out): diff --git a/infer/lib/python/inferlib/utils.py b/infer/lib/python/inferlib/utils.py index 115b4d2db..d84a656fc 100644 --- a/infer/lib/python/inferlib/utils.py +++ b/infer/lib/python/inferlib/utils.py @@ -278,6 +278,13 @@ def interact(): code.interact(local=locals()) +def mkdir_if_not_exists(path): + try: + os.mkdir(path) + except OSError: + pass + + def search_files(root_dir, extension): # Input: # - root directory where to start a recursive search of yjson files