]> granicus.if.org Git - clang/commitdiff
[scan-build-py] use python tempfile for tempdir
authorLaszlo Nagy <rizsotto.mailinglist@gmail.com>
Mon, 20 Mar 2017 09:03:24 +0000 (09:03 +0000)
committerLaszlo Nagy <rizsotto.mailinglist@gmail.com>
Mon, 20 Mar 2017 09:03:24 +0000 (09:03 +0000)
Differential Revision: https://reviews.llvm.org/D30862

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298238 91177308-0d34-0410-b5e6-96231b3b80d8

tools/scan-build-py/libscanbuild/__init__.py
tools/scan-build-py/libscanbuild/arguments.py
tools/scan-build-py/libscanbuild/intercept.py

index ca75174912fcd4ab3c899248cffcce837ac8c4af..800926ebb6f2f1379248637498f969792ec889b3 100644 (file)
@@ -41,12 +41,6 @@ def duplicate_check(method):
     return predicate
 
 
-def tempdir():
-    """ Return the default temorary directory. """
-
-    return os.getenv('TMPDIR', os.getenv('TEMP', os.getenv('TMP', '/tmp')))
-
-
 def run_build(command, *args, **kwargs):
     """ Run and report build command execution
 
index fe5725dcdf839dc5fc6e385b799ae4d0bdc51b3b..2735123f9f163a54561f405fa1b9bb82803458e4 100644 (file)
@@ -17,7 +17,8 @@ import os
 import sys
 import argparse
 import logging
-from libscanbuild import reconfigure_logging, tempdir
+import tempfile
+from libscanbuild import reconfigure_logging
 from libscanbuild.clang import get_checkers
 
 __all__ = ['parse_args_for_intercept_build', 'parse_args_for_analyze_build',
@@ -187,7 +188,7 @@ def create_analyze_parser(from_build_command):
         '--output',
         '-o',
         metavar='<path>',
-        default=tempdir(),
+        default=tempfile.gettempdir(),
         help="""Specifies the output directory for analyzer reports.
         Subdirectory will be created if default directory is targeted.""")
     output.add_argument(
index 71b957d83aca7ace1df1248c79e947d9df2382d6..b9bf9e917526d15b9fee19bafbc68626a713398d 100644 (file)
@@ -31,7 +31,7 @@ import logging
 from libear import build_libear, TemporaryDirectory
 from libscanbuild import command_entry_point, compiler_wrapper, \
     wrapper_environment, run_command, run_build
-from libscanbuild import duplicate_check, tempdir
+from libscanbuild import duplicate_check
 from libscanbuild.compilation import split_command
 from libscanbuild.arguments import parse_args_for_intercept_build
 from libscanbuild.shell import encode, decode
@@ -84,7 +84,7 @@ def capture(args):
                 for entry in itertools.chain(previous, current)
                 if os.path.exists(entry['file']) and not duplicate(entry))
 
-    with TemporaryDirectory(prefix='intercept-', dir=tempdir()) as tmp_dir:
+    with TemporaryDirectory(prefix='intercept-') as tmp_dir:
         # run the build command
         environment = setup_environment(args, tmp_dir)
         exit_code = run_build(args.build, env=environment)