Skip to content

Commit

Permalink
filter platform out of filename when finding .conda component files
Browse files Browse the repository at this point in the history
  • Loading branch information
msarahan committed Jun 5, 2024
1 parent d84753f commit 402cd95
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion conda_package_streaming/package_streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import bz2
import os
import os.path
import re
import tarfile
import zipfile
from enum import Enum
Expand Down Expand Up @@ -125,9 +126,11 @@ def stream_conda_component(

zf = zipfile.ZipFile(fileobj or filename)
file_id, _, _ = os.path.basename(filename).rpartition(".")
# this substitution compensates for web downloads from anaconda.org having the platform as a prefix
file_id = re.sub("^(osx|linux|win)-.+?_", "", file_id)
component_name = f"{component}-{file_id}"
component_filename = [
info for info in zf.infolist() if info.filename.startswith(component_name)
info for info in zf.infolist() if component_name in info.filename
]
if not component_filename:
raise LookupError(f"didn't find {component_name} component in {filename}")
Expand Down

0 comments on commit 402cd95

Please sign in to comment.