diff options
Diffstat (limited to 'llvm_tools')
-rwxr-xr-x | llvm_tools/get_llvm_hash.py | 9 | ||||
-rwxr-xr-x | llvm_tools/patch_manager.py | 14 | ||||
-rwxr-xr-x | llvm_tools/patch_manager_unittest.py | 10 |
3 files changed, 14 insertions, 19 deletions
diff --git a/llvm_tools/get_llvm_hash.py b/llvm_tools/get_llvm_hash.py index 1864170d..a5b5429e 100755 --- a/llvm_tools/get_llvm_hash.py +++ b/llvm_tools/get_llvm_hash.py @@ -10,18 +10,14 @@ from __future__ import print_function import argparse import os -import re import shutil import subprocess import sys import tempfile -import git_llvm_rev - from contextlib import contextmanager -from subprocess_helpers import CheckCommand -from subprocess_helpers import check_output -import requests +import git_llvm_rev +from subprocess_helpers import CheckCommand, check_output _LLVM_GIT_URL = ('https://chromium.googlesource.com/external/github.com/llvm' '/llvm-project') @@ -33,6 +29,7 @@ def GetVersionFrom(src_dir, git_hash): """Obtain an SVN-style version number based on the LLVM git hash passed in. Args: + src_dir: LLVM's source directory. git_hash: The git hash. Returns: diff --git a/llvm_tools/patch_manager.py b/llvm_tools/patch_manager.py index 910ecfc9..82a73ed8 100755 --- a/llvm_tools/patch_manager.py +++ b/llvm_tools/patch_manager.py @@ -8,17 +8,17 @@ from __future__ import print_function -from collections import namedtuple -from failure_modes import FailureModes -from subprocess_helpers import check_call -from subprocess_helpers import check_output - import argparse import json -import get_llvm_hash import os import subprocess import sys +from collections import namedtuple + +import get_llvm_hash +from failure_modes import FailureModes +from subprocess_helpers import check_call +from subprocess_helpers import check_output def is_directory(dir_path): @@ -279,8 +279,6 @@ def UpdatePatchMetadataFile(patch_metadata_file, patches): def GetCommitHashesForBisection(src_path, good_svn_version, bad_svn_version): """Gets the good and bad commit hashes required by `git bisect start`.""" - new_llvm_hash = LLVMHash() - bad_commit_hash = get_llvm_hash.GetGitHashFrom(src_path, bad_svn_version) good_commit_hash = get_llvm_hash.GetGitHashFrom(src_path, good_svn_version) diff --git a/llvm_tools/patch_manager_unittest.py b/llvm_tools/patch_manager_unittest.py index 90200ab8..62947ed1 100755 --- a/llvm_tools/patch_manager_unittest.py +++ b/llvm_tools/patch_manager_unittest.py @@ -14,11 +14,11 @@ import subprocess import unittest import unittest.mock as mock +import patch_manager from failure_modes import FailureModes from test_helpers import CallCountsToMockFunctions from test_helpers import CreateTemporaryJsonFile from test_helpers import WritePrettyJsonFile -import patch_manager class PatchManagerTest(unittest.TestCase): @@ -326,8 +326,8 @@ class PatchManagerTest(unittest.TestCase): # Simulate behavior of 'GetPathToPatch()' when the absolute path to the # patch does not exist. def PathToPatchDoesNotExist(filesdir_path, rel_patch_path): - raise ValueError( - 'The absolute path to %s does not exist' % abs_patch_path) + raise ValueError('The absolute path to %s does not exist' % os.path.join( + filesdir_path, rel_patch_path)) # Use the test function to simulate the behavior of 'GetPathToPatch()'. mock_get_path_to_patch.side_effect = PathToPatchDoesNotExist @@ -463,7 +463,7 @@ class PatchManagerTest(unittest.TestCase): # Simulate behavior for 'ApplyPatch()' when applying multiple applicable # patches. @CallCountsToMockFunctions - def MultipleCallsToApplyPatches(call_count, src_path, path_to_patch): + def MultipleCallsToApplyPatches(call_count, _src_path, path_to_patch): if call_count < 3: self.assertEqual( path_to_patch, @@ -569,7 +569,7 @@ class PatchManagerTest(unittest.TestCase): # Simulate behavior for 'ApplyPatch()' when applying multiple applicable # patches. @CallCountsToMockFunctions - def MultipleCallsToApplyPatches(call_count, src_path, path_to_patch): + def MultipleCallsToApplyPatches(call_count, _src_path, path_to_patch): if call_count < 3: self.assertEqual( path_to_patch, |