Fixed pbr install to not error out and fail if git is not installed

Fixed the issue where pbr was erroring out (file not found) when
running 'python setup.py egg_info' since it was trying to get the
.git directory even if git was not installed.

Closes bug 1245676

Change-Id: I31e1f86f10f18897774b49eb293aede31641db31
This commit is contained in:
Nikhil Manchanda 2013-10-30 03:08:48 -07:00
parent e8a3c7e7ba
commit 629bbce1c8
1 changed files with 5 additions and 1 deletions

View File

@ -225,6 +225,10 @@ def _get_git_directory():
return _run_shell_command(['git', 'rev-parse', '--git-dir'])
def _git_is_installed():
return _run_shell_command(['which', 'git'])
def get_boolean_option(option_dict, option_name, env_name):
return ((option_name in option_dict
and option_dict[option_name][1].lower() in TRUE_VALUES) or
@ -306,7 +310,7 @@ def _find_git_files(dirname='', git_dir=None):
at absurd times. We only want to do this when we are building an sdist.
"""
file_list = []
if git_dir is None:
if git_dir is None and _git_is_installed():
git_dir = _get_git_directory()
if git_dir:
log.info("[pbr] In git context, generating filelist from git")