Merge "Fix package-installs for python3"

This commit is contained in:
Jenkins 2016-02-02 03:16:11 +00:00 committed by Gerrit Code Review
commit cd3c704fbf

View file

@ -25,7 +25,7 @@ def process_output(cmdline):
# in Python 2.7+, gracefully falling back to subprocess.Popen # in Python 2.7+, gracefully falling back to subprocess.Popen
# in older Python versions. # in older Python versions.
try: try:
return subprocess.check_output(cmdline) return subprocess.check_output(cmdline).decode(encoding='utf-8')
except AttributeError: except AttributeError:
proc = subprocess.Popen(cmdline, stdout=subprocess.PIPE) proc = subprocess.Popen(cmdline, stdout=subprocess.PIPE)
out = proc.communicate()[0] out = proc.communicate()[0]
@ -66,12 +66,12 @@ def main():
for (pkg, element) in install_packages: for (pkg, element) in install_packages:
print("%sing %s from %s" % (install, pkg, element)) print("%sing %s from %s" % (install, pkg, element))
pkg_map_args = ["pkg-map", "--missing-ok", "--element", element] pkg_map_args = ['pkg-map', '--missing-ok', '--element', element, pkg]
pkg_map_args.append(pkg)
try: try:
map_output = process_output( map_output = process_output(
pkg_map_args) pkg_map_args)
pkgs.extend(map_output.strip().split('\n'))
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
if e.returncode == 1: if e.returncode == 1:
if args.noop: if args.noop:
@ -83,7 +83,6 @@ def main():
elif e.returncode == 2: elif e.returncode == 2:
pkgs.append(pkg) pkgs.append(pkg)
continue continue
pkgs.extend(map_output.strip().split('\n'))
install_args = ["install-packages"] install_args = ["install-packages"]
if args.uninstall: if args.uninstall: