From 19be04eccef608df2839edababd4b87defdaee2c Mon Sep 17 00:00:00 2001 From: KongQun Yang Date: Fri, 26 May 2017 13:52:42 -0700 Subject: [PATCH] Fix git not found on some Windows setups Change-Id: I0403212f383e60ef75b426170783933f4d73b211 --- packager/app/test/packager_test.py | 5 +---- packager/version/generate_version_string.py | 9 ++------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/packager/app/test/packager_test.py b/packager/app/test/packager_test.py index 472ba9eb4a..38bc66cc70 100755 --- a/packager/app/test/packager_test.py +++ b/packager/app/test/packager_test.py @@ -793,10 +793,7 @@ class PackagerAppTest(unittest.TestCase): else: match = filecmp.cmp(test_output, golden_file) if not match: - git = 'git' - if platform.system() == 'Windows': - git += '.bat' - p = subprocess.Popen([git, '--no-pager', 'diff', '--color=auto', + p = subprocess.Popen(['git', '--no-pager', 'diff', '--color=auto', '--no-ext-diff', '--no-index', golden_file, test_output], stdout=subprocess.PIPE, diff --git a/packager/version/generate_version_string.py b/packager/version/generate_version_string.py index b35caf403a..214a7e36ee 100755 --- a/packager/version/generate_version_string.py +++ b/packager/version/generate_version_string.py @@ -7,7 +7,6 @@ # https://developers.google.com/open-source/licenses/bsd """This script is used to generate version string for packager.""" -import platform import subprocess # To support python version before 2.7, which does not have @@ -31,13 +30,9 @@ if 'check_output' not in dir(subprocess): subprocess.check_output = check_output_implementation if __name__ == '__main__': - git = 'git' - if platform.system() == 'Windows': - git += '.bat' - try: version_tag = subprocess.check_output( - [git, 'tag', '--points-at', 'HEAD'], + ['git', 'tag', '--points-at', 'HEAD'], stderr=subprocess.STDOUT).rstrip() except subprocess.CalledProcessError as e: # git tag --points-at is not supported in old versions of git. Just ignore @@ -46,7 +41,7 @@ if __name__ == '__main__': try: version_hash = subprocess.check_output( - [git, 'rev-parse', '--short', 'HEAD'], + ['git', 'rev-parse', '--short', 'HEAD'], stderr=subprocess.STDOUT).rstrip() except subprocess.CalledProcessError as e: version_hash = 'unknown-version'