bootstrap: fall back to the default upstream URL

Fixes #352.
This commit is contained in:
Ben Boeckel 2016-04-27 15:00:47 -04:00
parent eb388306fd
commit 6f69c01915

View File

@ -31,6 +31,8 @@
import spack
from spack.util.executable import which
_SPACK_UPSTREAM = 'https://github.com/llnl/spack'
description = "Create a new installation of spack in another prefix"
def setup_parser(subparser):
@ -40,9 +42,15 @@ def setup_parser(subparser):
def get_origin_url():
git_dir = join_path(spack.prefix, '.git')
git = which('git', required=True)
try:
origin_url = git(
'--git-dir=%s' % git_dir, 'config', '--get', 'remote.origin.url',
'--git-dir=%s' % git_dir,
'config', '--get', 'remote.origin.url',
output=str)
except ProcessError:
origin_url = _SPACK_UPSTREAM
tty.warn('No git repository found; '
'using default upstream URL: %s' % origin_url)
return origin_url.strip()