Skip to content

Commit

Permalink
Merge pull request #123 from SimeonStoykovQC/fix-windows-auth
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusvniekerk authored Nov 12, 2021
2 parents 49a920a + d9ad79c commit 38cfbde
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions conda_lock/conda_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -791,10 +791,16 @@ def _add_auth_to_lockfile(lockfile: str, auth: Dict[str, str]) -> str:

@contextmanager
def _add_auth(lockfile: str, auth: Dict[str, str]) -> Iterator[str]:
with tempfile.NamedTemporaryFile() as tf:
lockfile_with_auth = _add_auth_to_lockfile(lockfile, auth)
lockfile_with_auth = _add_auth_to_lockfile(lockfile, auth)

# On Windows, NamedTemporaryFiles can't be opened a second time, so we have to close it first (and delete it manually later)
tf = tempfile.NamedTemporaryFile(delete=False)
try:
tf.close()
write_file(lockfile_with_auth, tf.name)
yield tf.name
finally:
os.unlink(tf.name)


def _strip_auth_from_line(line: str) -> str:
Expand Down

0 comments on commit 38cfbde

Please sign in to comment.