Fix git not found on some Windows setups
Change-Id: I0403212f383e60ef75b426170783933f4d73b211
This commit is contained in:
parent
32b088c4bc
commit
19be04ecce
|
@ -793,10 +793,7 @@ class PackagerAppTest(unittest.TestCase):
|
||||||
else:
|
else:
|
||||||
match = filecmp.cmp(test_output, golden_file)
|
match = filecmp.cmp(test_output, golden_file)
|
||||||
if not match:
|
if not match:
|
||||||
git = 'git'
|
p = subprocess.Popen(['git', '--no-pager', 'diff', '--color=auto',
|
||||||
if platform.system() == 'Windows':
|
|
||||||
git += '.bat'
|
|
||||||
p = subprocess.Popen([git, '--no-pager', 'diff', '--color=auto',
|
|
||||||
'--no-ext-diff', '--no-index', golden_file,
|
'--no-ext-diff', '--no-index', golden_file,
|
||||||
test_output],
|
test_output],
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
# https://developers.google.com/open-source/licenses/bsd
|
# https://developers.google.com/open-source/licenses/bsd
|
||||||
"""This script is used to generate version string for packager."""
|
"""This script is used to generate version string for packager."""
|
||||||
|
|
||||||
import platform
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
# To support python version before 2.7, which does not have
|
# 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
|
subprocess.check_output = check_output_implementation
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
git = 'git'
|
|
||||||
if platform.system() == 'Windows':
|
|
||||||
git += '.bat'
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
version_tag = subprocess.check_output(
|
version_tag = subprocess.check_output(
|
||||||
[git, 'tag', '--points-at', 'HEAD'],
|
['git', 'tag', '--points-at', 'HEAD'],
|
||||||
stderr=subprocess.STDOUT).rstrip()
|
stderr=subprocess.STDOUT).rstrip()
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
# git tag --points-at is not supported in old versions of git. Just ignore
|
# git tag --points-at is not supported in old versions of git. Just ignore
|
||||||
|
@ -46,7 +41,7 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
try:
|
try:
|
||||||
version_hash = subprocess.check_output(
|
version_hash = subprocess.check_output(
|
||||||
[git, 'rev-parse', '--short', 'HEAD'],
|
['git', 'rev-parse', '--short', 'HEAD'],
|
||||||
stderr=subprocess.STDOUT).rstrip()
|
stderr=subprocess.STDOUT).rstrip()
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
version_hash = 'unknown-version'
|
version_hash = 'unknown-version'
|
||||||
|
|
Loading…
Reference in New Issue