r298238 - [scan-build-py] use python tempfile for tempdir

Laszlo Nagy via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 20 02:03:25 PDT 2017


Author: rizsotto
Date: Mon Mar 20 04:03:24 2017
New Revision: 298238

URL: http://llvm.org/viewvc/llvm-project?rev=298238&view=rev
Log:
[scan-build-py] use python tempfile for tempdir

Differential Revision: https://reviews.llvm.org/D30862

Modified:
    cfe/trunk/tools/scan-build-py/libscanbuild/__init__.py
    cfe/trunk/tools/scan-build-py/libscanbuild/arguments.py
    cfe/trunk/tools/scan-build-py/libscanbuild/intercept.py

Modified: cfe/trunk/tools/scan-build-py/libscanbuild/__init__.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build-py/libscanbuild/__init__.py?rev=298238&r1=298237&r2=298238&view=diff
==============================================================================
--- cfe/trunk/tools/scan-build-py/libscanbuild/__init__.py (original)
+++ cfe/trunk/tools/scan-build-py/libscanbuild/__init__.py Mon Mar 20 04:03:24 2017
@@ -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
 

Modified: cfe/trunk/tools/scan-build-py/libscanbuild/arguments.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build-py/libscanbuild/arguments.py?rev=298238&r1=298237&r2=298238&view=diff
==============================================================================
--- cfe/trunk/tools/scan-build-py/libscanbuild/arguments.py (original)
+++ cfe/trunk/tools/scan-build-py/libscanbuild/arguments.py Mon Mar 20 04:03:24 2017
@@ -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_com
         '--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(

Modified: cfe/trunk/tools/scan-build-py/libscanbuild/intercept.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build-py/libscanbuild/intercept.py?rev=298238&r1=298237&r2=298238&view=diff
==============================================================================
--- cfe/trunk/tools/scan-build-py/libscanbuild/intercept.py (original)
+++ cfe/trunk/tools/scan-build-py/libscanbuild/intercept.py Mon Mar 20 04:03:24 2017
@@ -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)




More information about the cfe-commits mailing list