Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install wheel fixes #1

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions conda/core/extract_whl.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,17 @@ class MyWheelDestination(WheelDestination):
def __init__(self, target_full_path: str) -> None:
self.target_full_path = target_full_path
self.sp_dir = os.path.join(target_full_path, "site-packages")
self.entry_points = []

def write_script(self, name: str, module: str, attr: str, section: Literal['console'] | Literal['gui']) -> RecordEntry:
raise NotImplementedError("scripts not supported at this time")
# TODO check if console/gui
entry_point = f"{name} = {module}:{attr}"
self.entry_points.append(entry_point)
return RecordEntry(
path="../../../bin/{name}",
hash_=None,
size=None,
)

def write_file(self, scheme: Scheme, path: str | PathLike[str], stream: BinaryIO, is_executable: bool) -> RecordEntry:
if scheme not in SUPPORTED_SCEMES:
Expand All @@ -45,7 +53,7 @@ def write_file(self, scheme: Scheme, path: str | PathLike[str], stream: BinaryIO
)

if is_executable:
installer.utils.make_file_executable(dest)
installer.utils.make_file_executable(dest_path)

return RecordEntry(
path=path,
Expand All @@ -65,12 +73,17 @@ def _create_conda_metadata(self, records: Iterable[Tuple[Scheme, RecordEntry]])
},
"package_metadata_version": 1
}
if self.entry_points:
link_json_data["noarch"]["entry_points"] = self.entry_points
link_json_path = os.path.join(self.target_full_path, "info", "link.json")
write_as_json_to_file(link_json_path, link_json_data)

# paths.json
paths = []
for _, record in records:
if record.path.startswith('..'):
# entry point
continue
path = {
"_path": f"site-packages/{record.path}",
"path_type": "hardlink",
Expand Down
1 change: 1 addition & 0 deletions conda/core/prefix_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ def _load_single_record(self, prefix_record_json_path):
try:
if prefix_record.fn.endswith(".whl"):
n, v, b = basename(prefix_record_json_path)[:-5].split("-", 2)
n = n.lower().replace("_", "-")
else:
n, v, b = basename(prefix_record_json_path)[:-5].rsplit("-", 2)
if (n, v, b) != (
Expand Down