Merge pull request #149 from yuvipanda/conda-version

Don't capture stderr when calling conda
This commit is contained in:
Yuvi Panda
2018-08-20 14:52:03 -07:00
committed by GitHub

View File

@@ -84,13 +84,15 @@ def ensure_conda_packages(prefix, packages):
conda_executable = [os.path.join(prefix, 'bin', 'python'), '-m', 'conda'] conda_executable = [os.path.join(prefix, 'bin', 'python'), '-m', 'conda']
abspath = os.path.abspath(prefix) abspath = os.path.abspath(prefix)
# Let subprocess errors propagate # Let subprocess errors propagate
# Explicitly do *not* capture stderr, since that's not always JSON!
# Scripting conda is a PITA!
# FIXME: raise different exception when using # FIXME: raise different exception when using
raw_output = subprocess.check_output(conda_executable + [ raw_output = subprocess.check_output(conda_executable + [
'install', 'install',
'-c', 'conda-forge', # Make customizable if we ever need to '-c', 'conda-forge', # Make customizable if we ever need to
'--json', '--json',
'--prefix', abspath '--prefix', abspath
] + packages, stderr=subprocess.STDOUT).decode() ] + packages).decode()
# `conda install` outputs JSON lines for fetch updates, # `conda install` outputs JSON lines for fetch updates,
# and a undelimited output at the end. There is no reasonable way to # and a undelimited output at the end. There is no reasonable way to
# parse this outside of this kludge. # parse this outside of this kludge.