Can now specify upstream of anyname through -u/--upstream flag

This commit is contained in:
Carson Woods
2019-07-17 16:07:12 -06:00
parent d4a959736a
commit ff96ec430b
3 changed files with 15 additions and 4 deletions

View File

@@ -39,7 +39,8 @@ def update_kwargs_from_args(args, kwargs):
'fake': args.fake,
'dirty': args.dirty,
'use_cache': args.use_cache,
'install_global': args.install_global
'install_global': args.install_global,
'upstream': args.upstream
})
if hasattr(args, 'setup'):
setups = set()

View File

@@ -94,7 +94,12 @@ def find_matching_specs(env, specs, allow_multiple_matches=False, force=False,
spack.config.set('config:active_tree', global_root,
scope='user')
elif upstream:
raise NotImplementedError
if upstream not in spack.config.get('upstreams'):
tty.die("specified upstream does not exist")
root = spack.config.get('upstreams')
root = root[upstream]['install_tree']
root = spack.util.path.canonicalize_path(root)
spack.config.set('config:active_tree', root, scope='user')
else:
for spec in specs:
if isinstance(spec, spack.spec.Spec):

View File

@@ -1492,7 +1492,7 @@ def do_install(self, **kwargs):
dirty = kwargs.get('dirty', False)
restage = kwargs.get('restage', False)
install_global = kwargs.get('install_global', False)
upstream = kwargs.get('upstream', False)
upstream = kwargs.get('upstream', None)
# Install Package to Global Upstream for multi-user use
if install_global:
@@ -1502,7 +1502,12 @@ def do_install(self, **kwargs):
spack.config.set('config:active_tree', global_root,
scope='user')
elif upstream:
raise NotImplementedError
if upstream not in spack.config.get('upstreams'):
tty.die("specified upstream does not exist")
root = spack.config.get('upstreams')
root = root[upstream]['install_tree']
root = spack.util.path.canonicalize_path(root)
spack.config.set('config:active_tree', root, scope='user')
else:
spack.config.set('config:active_tree',
spack.config.get('config:install_tree'),