Skip to content

Commit

Permalink
Fixes for pip support (#298)
Browse files Browse the repository at this point in the history
.extend not available on Python dict

options (e.g. --index-url) were getting swallowed and not added to final spec
  • Loading branch information
jonzeper authored and pierrotsmnrd committed May 10, 2022
1 parent c137b4b commit 07f90a7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions conda-store-server/conda_store_server/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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})

Expand Down

0 comments on commit 07f90a7

Please sign in to comment.