Merge pull request #46012 from rallytime/bp-45462

Back-port #45462 to 2017.7
This commit is contained in:
Nicole Thomas 2018-02-14 13:14:55 -05:00 committed by GitHub
commit 96097c037e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -306,13 +306,13 @@ def install(name=None, refresh=False, pkgs=None, **kwargs):
if pkgs is None:
version_num = kwargs.get('version')
variant_spec = kwargs.get('variant')
spec = None
spec = {}
if version_num:
spec = (spec or '') + '@' + version_num
spec['version'] = version_num
if variant_spec:
spec = (spec or '') + variant_spec
spec['variant'] = variant_spec
pkg_params = {name: spec}
@ -321,7 +321,14 @@ def install(name=None, refresh=False, pkgs=None, **kwargs):
formulas_array = []
for pname, pparams in six.iteritems(pkg_params):
formulas_array.append(pname + (pparams or ''))
formulas_array.append(pname)
if pparams:
if 'version' in pparams:
formulas_array.append('@' + pparams['version'])
if 'variant' in pparams:
formulas_array.append(pparams['variant'])
old = list_pkgs()
cmd = ['port', 'install']