Skip to content

Commit

Permalink
fix conda#247: support auth for private pypi packages
Browse files Browse the repository at this point in the history
  • Loading branch information
croth1 committed Jan 29, 2023
1 parent 2cee379 commit 801110f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion conda_lock/conda_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -914,8 +914,11 @@ def _add_auth_to_line(line: str, auth: Dict[str, str]) -> str:


def _add_auth_to_lockfile(lockfile: str, auth: Dict[str, str]) -> str:
# do not substitute in comments, but do substitute in pip installable packages
# with the pattern: # pip package @ url.
pkg_pattern = re.compile(r"(^[^#@].*|^# pip .*)")
lockfile_with_auth = "\n".join(
_add_auth_to_line(line, auth) if line[0] not in ("#", "@") else line
_add_auth_to_line(line, auth) if pkg_pattern.match(line) else line
for line in lockfile.strip().split("\n")
)
if lockfile.endswith("\n"):
Expand Down

0 comments on commit 801110f

Please sign in to comment.