From 07f90a78cddc011c300ad8e3e5c9b9b50b889690 Mon Sep 17 00:00:00 2001 From: jonzeper Date: Fri, 6 May 2022 08:06:11 -0700 Subject: [PATCH] Fixes for pip support (#298) .extend not available on Python dict options (e.g. --index-url) were getting swallowed and not added to final spec --- conda-store-server/conda_store_server/environment.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/conda-store-server/conda_store_server/environment.py b/conda-store-server/conda_store_server/environment.py index 854a2d560..fd15f4b79 100644 --- a/conda-store-server/conda_store_server/environment.py +++ b/conda-store-server/conda_store_server/environment.py @@ -103,8 +103,11 @@ def validate_environment_pypi_packages( def _package_names(packages): result = {} for p in packages: - if isinstance(p, str) and not p.startswith("--"): - result[Requirement.parse(p).name] = p + if isinstance(p, str): + if p.startswith("--"): + result[p] = p + else: + result[Requirement.parse(p).name] = p return result def _get_pip_packages(specification): @@ -116,7 +119,7 @@ def _get_pip_packages(specification): def _append_pip_packages(specification, packages): for package in specification.dependencies: if isinstance(package, dict) and "pip" in package: - package.extend(packages) + package["pip"] += packages return specification.dependencies.append({"pip": packages})