forked from OSchip/llvm-project
[scan-build-py] use python tempfile for tempdir
Differential Revision: https://reviews.llvm.org/D30862 llvm-svn: 298238
This commit is contained in:
parent
f4fa291d83
commit
0d9be63001
|
@ -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
|
||||
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue