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

Fix path separator on Windows distributions #275

Merged
merged 8 commits into from
Aug 4, 2023
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
6 changes: 4 additions & 2 deletions conda_pack/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1002,8 +1002,10 @@ def rewrite_conda_meta(source):
script_dir = os.path.dirname(__file__)
new_prefix = os.path.abspath(os.path.dirname(script_dir))
for path, placeholder, mode in _prefix_records:
update_prefix(os.path.join(new_prefix, path), new_prefix,
placeholder, mode=mode)
new_path = os.path.join(new_prefix, path)
if on_win:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if on_win:
if on_win and mode == 'text':

Do we need the same construct here too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried this, and found some instances that raised the same error, so I believe now that the issue is more general.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case should the other instance of this if clause be adjusted to not have the mode == 'text' check?

Copy link
Contributor Author

@andysham andysham Aug 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps, although given the failure is rising in particular from open(...), where new_prefix (from this scope) is never used, I would suggest these conversions serve different purposes - I would imagine altering the representation of Windows filepaths to Linux filepaths isn't as well supported in Windows binary applications as in Python. Regardless, I feel more comfortable making the minimal change, and the above change doesn't propagate further than the current Python process.

new_path = new_path.replace('\\\\', '/')
update_prefix(new_path, new_prefix, placeholder, mode=mode)
"""


Expand Down
19 changes: 19 additions & 0 deletions news/275-fix-windows-seperator
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Enhancements

* <news item>

### Bug fixes

* Fixed bug in environment path separators preventing unpacking on Windows distributions. (#275)

### Deprecations

* <news item>

### Docs

* <news item>

### Other

* <news item>