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 crash when using conda-pack on environments created with pixi #305

Merged
merged 3 commits into from
Jan 21, 2024
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
21 changes: 13 additions & 8 deletions conda_pack/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@ def load_environment(prefix, on_missing_cache='warn', ignore_editable_packages=F
with open(os.path.join(conda_meta, path)) as fil:
info = json.load(fil)

pkg = info['link']['source']
pkg = info['link']['source'] if info['link'] else ""

if not os.path.exists(pkg):
# Package cache is cleared, set file_mode='unknown' to properly
Expand Down Expand Up @@ -930,12 +930,17 @@ def load_environment(prefix, on_missing_cache='warn', ignore_editable_packages=F
file_mode=None))

# Add remaining conda metadata files
managed.add(os.path.join('conda-meta', 'history'))
files.append(File(os.path.join(conda_meta, 'history'),
os.path.join('conda-meta', 'history'),
is_conda=True,
prefix_placeholder=None,
file_mode=None))
if os.path.exists(os.path.join(conda_meta, "history")):
managed.add(os.path.join("conda-meta", "history"))
files.append(
File(
os.path.join(conda_meta, "history"),
os.path.join("conda-meta", "history"),
is_conda=True,
prefix_placeholder=None,
file_mode=None,
)
)

if missing_files and not ignore_missing_files:
packages = []
Expand Down Expand Up @@ -1019,7 +1024,7 @@ def rewrite_conda_meta(source):
if field in data:
data[field] = ""

if "link" in data and "source" in data["link"]:
if "link" in data and data["link"] and "source" in data["link"]:
data["link"]["source"] = ""

out = json.dumps(data, indent=True, sort_keys=True)
Expand Down
19 changes: 19 additions & 0 deletions news/support-pixi-environments.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Enhancements

* <news item>

### Bug fixes

* Fix a crash when trying to use conda-pack environments created with [pixi](https://pixi.sh).

### Deprecations

* <news item>

### Docs

* <news item>

### Other

* <news item>