diff --git a/conda_app.py b/conda_app.py index fa2f966658f04edff251bf1eedcc81c673ffbcbd..45ab61e34f467aee72fff93a553f0796a8019006 100644 --- a/conda_app.py +++ b/conda_app.py @@ -32,22 +32,11 @@ if not is_conda_avail and not is_mamba_avail: def run_conda(*args, conda_command="conda", capture_output=True): cmd = [conda_command] cmd.extend(args) - - if capture_output: - completed_process = subprocess.run( - cmd, capture_output=capture_output, text=True - ) - completed_process.check_returncode() - return completed_process.stdout - else: - lines = [] - with subprocess.Popen( - cmd, stdout=subprocess.PIPE, bufsize=1, text=True - ) as process: - for line in iter(process.stdout.readline, ""): - print(line, end="") - lines.append(line) - return "\n".join(lines) + completed_process = subprocess.run( + cmd, capture_output=capture_output, text=True + ) + completed_process.check_returncode() + return completed_process.stdout commands_app = {"mercurial": ["hg"], "tortoisehg": ["hg", "thg"]} @@ -268,7 +257,7 @@ def install_app(app_name): else: conda_command = "conda" - result = run_conda( + run_conda( "create", "-n", env_name, @@ -278,13 +267,11 @@ def install_app(app_name): capture_output=False, ) + result = run_conda("env", "list") for line in result.split("\n"): - if "Prefix: " in line: + if env_name in line: prefix = line.split()[1] break - if "environment location: " in line: - prefix = line.split()[2] - break env_path = Path(prefix) diff --git a/setup.cfg b/setup.cfg index 873477038bfc8d1306a8cf19132d4af5434885e0..fbd4d1b93687ebfd8e050250dd268f2e3d8f6147 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = conda-app -version = 0.3.0 +version = 0.3.1 author = Pierre Augier author-email = pierre.augier@univ-grenoble-alpes.fr url = https://foss.heptapod.net/fluiddyn/conda-app/ @@ -15,6 +15,8 @@ classifiers = Programming Language :: Python :: 3 Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 [options] py_modules = conda_app