Skip to content
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ build/
conda-bld/
.conda-env-vars

# Allow conda files in test data
!tests/data/channels/channels/**/*.conda

# Python
__pycache__/
*.py[cod]
Expand Down Expand Up @@ -111,4 +114,3 @@ secrets.json
# Generated files
*_pb2.py
*_pb2_grpc.py

33 changes: 14 additions & 19 deletions crates/pixi_cli/src/global/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ use crate::global::revert_environment_after_error;
use clap::Parser;
use fancy_display::FancyDisplay;
use pixi_config::{Config, ConfigCli};
use pixi_global::StateChanges;
use pixi_global::common::check_all_exposed;
use pixi_global::project::ExposedType;
use pixi_global::{EnvironmentName, Project};
use pixi_global::{StateChange, StateChanges};

/// Updates environments in the global environment.
#[derive(Parser, Debug, Clone)]
Expand All @@ -27,18 +27,10 @@ pub async fn execute(args: Args) -> miette::Result<()> {
env_name: &EnvironmentName,
project: &mut Project,
) -> miette::Result<StateChanges> {
let mut state_changes = StateChanges::default();
// If the environment isn't up-to-date our executable detection afterwards will not work
let require_reinstall = if !project.environment_in_sync_internal(env_name, true).await? {
let environment_update = project.install_environment(env_name).await?;
state_changes.insert_change(
env_name,
pixi_global::StateChange::UpdatedEnvironment(environment_update),
);
false
} else {
true
};
if !project.environment_in_sync(env_name).await? {
let _ = project.install_environment(env_name).await?;
}

// See what executables were installed prior to update
let env_binaries = project.executables_of_direct_dependencies(env_name).await?;
Expand All @@ -57,17 +49,20 @@ pub async fn execute(args: Args) -> miette::Result<()> {
};

// Reinstall the environment
if require_reinstall {
let environment_update = project.install_environment(env_name).await?;
let environment_update = project.install_environment(env_name).await?;

let mut state_changes = StateChanges::default();

state_changes.insert_change(
env_name,
StateChange::UpdatedEnvironment(environment_update),
);

state_changes.insert_change(
env_name,
pixi_global::StateChange::UpdatedEnvironment(environment_update),
);
}
// Sync executables exposed names with the manifest
project.sync_exposed_names(env_name, expose_type).await?;

state_changes |= project.sync_shortcuts(env_name).await?;

// Expose or prune executables of the new environment
state_changes |= project
.expose_executables_from_environment(env_name)
Expand Down
8 changes: 8 additions & 0 deletions crates/pixi_global/src/project/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1178,6 +1178,10 @@ impl Project {
shortcuts_sync_status(shortcuts, prefix_records, prefix.root())?;

for record in records_to_install {
tracing::debug!(
"Installing menuitems for record: {}",
record.name().as_normalized()
);
rattler_menuinst::install_menuitems_for_record(
prefix.root(),
&record,
Expand All @@ -1200,6 +1204,10 @@ impl Project {
}

for record in records_to_uninstall {
tracing::debug!(
"Uninstalling menuitems for record: {}",
record.name().as_normalized()
);
rattler_menuinst::remove_menuitems_for_record(prefix.root(), record.clone())
.into_diagnostic()?;

Expand Down
122 changes: 112 additions & 10 deletions pixi.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ pytest-rerunfailures = ">=15,<16"
pytest-timeout = ">=2.3.1,<3"
pytest-xdist = ">=3.6.1,<4"
pyyaml = ">=6.0.2,<7"
rattler-build = "==0.36.0"
rich = ">=14,<15"
tomli-w = ">=1.0,<2"
types-pyyaml = ">=6.0.12.20241230,<7"
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,32 @@
},
"packages": {},
"packages.conda": {
"pixi-editor-0.1.3-h4616a5c_0.conda": {
"pixi-editor-1.0.0-h4616a5c_0.conda": {
"build": "h4616a5c_0",
"build_number": 0,
"depends": [],
"md5": "710f47b333ecfeeaf1fd8e1b02542283",
"md5": "5b8c04e66f6bcbdf6563e3a84c4a92bc",
"name": "pixi-editor",
"noarch": "generic",
"sha256": "aa4823f8f8c9d999a97f7f85e17f24495b45892a6619c7875a255462bcb5e7d4",
"size": 335330,
"sha256": "181254b2d6a343088c939f6e2c077a0a1b5dd75b48dedc375078093263d1d419",
"size": 335993,
"subdir": "noarch",
"timestamp": 1740648548184,
"version": "0.1.3"
"timestamp": 1756486136456,
"version": "1.0.0"
},
"pixi-editor-2.0.0-h4616a5c_0.conda": {
"build": "h4616a5c_0",
"build_number": 0,
"depends": [],
"md5": "d604f124886b285caf9a635f3e9ed8b5",
"name": "pixi-editor",
"noarch": "generic",
"sha256": "9fb8e7bcc3d7b62b0d75d160a08a980962eeb47450c591b18c0181b7fec95bcb",
"size": 337199,
"subdir": "noarch",
"timestamp": 1756486145266,
"version": "2.0.0"
}
},
"repodata_version": 2
}
}
3 changes: 2 additions & 1 deletion tests/data/channels/mappings.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
"multiple_versions_channel_1_020.yaml" = "multiple_versions_channel_1"
"non_self_expose_channel_1.yaml" = "non_self_expose_channel_1"
"non_self_expose_channel_2.yaml" = "non_self_expose_channel_2"
"pixi-editor/recipe.yaml" = "shortcuts_channel_1"
"post_link_script_package/recipe.yaml" = "post_link_script_channel"
"shortcuts_channel_1/1/recipe.yaml" = "shortcuts_channel_1"
"shortcuts_channel_1/2/recipe.yaml" = "shortcuts_channel_1"
"trampoline/trampoline_1.yaml" = "trampoline_channel"
"trampoline/trampoline_2.yaml" = "trampoline_channel"
"trampoline/trampoline_path.yaml" = "trampoline_path_channel"
55 changes: 0 additions & 55 deletions tests/data/channels/recipes/pixi-editor/Menu/menu.json

This file was deleted.

31 changes: 0 additions & 31 deletions tests/data/channels/recipes/pixi-editor/recipe.yaml

This file was deleted.

46 changes: 46 additions & 0 deletions tests/data/channels/recipes/shortcuts_channel_1/1/Menu/menu.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"$schema": "https://json-schema.org/draft-07/schema",
"$id": "https://schemas.conda.io/menuinst-1.schema.json",
"menu_name": "pixi-editor",
"menu_items": [
{
"name": {
"target_environment_is_base": "pixi-editor",
"target_environment_is_not_base": "pixi-editor ({{ ENV_NAME }})"
},
"description": "Pixi Editor 1",
"icon": "{{ MENU_DIR }}/another-icon.{{ ICON_EXT }}",
"activate": false,
"terminal": false,
"command": [""],
"platforms": {
"win": {
"desktop": true,
"app_user_model_id": "dev.prefix.pixi-editor",
"command": ["notepad.exe", "%*"],
"file_extensions": [".pixi"]
},
"linux": {
"Categories": ["Development", "Science"],
"command": ["gedit", "%F"],
"MimeType": ["text/x-pixi"]
},
"osx": {
"command": ["open", "-a", "TextEdit"],
"CFBundleName": "Pixi Editor",
"CFBundleIdentifier": "dev.prefix.pixi-editor",
"CFBundleVersion": "0.1.0",
"CFBundleDocumentTypes": [
{
"CFBundleTypeName": "text document",
"CFBundleTypeRole": "Editor",
"LSHandlerRank": "Default",
"CFBundleTypeIconFile": "another-icon.icns",
"LSItemContentTypes": ["public.pixi"]
}
]
}
}
}
]
}
32 changes: 32 additions & 0 deletions tests/data/channels/recipes/shortcuts_channel_1/1/recipe.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
outputs:
- package:
name: pixi-editor
version: "1.0.0"

requirements:
build:
- python

build:
noarch: generic
script:
interpreter: python
content: |
import os
import shutil
from pathlib import Path

prefix = os.environ.get("PREFIX", "")
recipe_dir = os.environ.get("RECIPE_DIR", "")

menu_dir = Path(prefix) / "Menu"
menu_dir.mkdir(parents=True, exist_ok=True)

# Copy menu.json
shutil.copy(Path(recipe_dir) / "Menu" / "menu.json", menu_dir / "pixi-editor.json")

# Copy icon files
for icon_name in ["another-icon.ico", "another-icon.png", "another-icon.icns"]:
src = Path(recipe_dir) / "Menu" / icon_name
if src.exists():
shutil.copy(src, menu_dir)
46 changes: 46 additions & 0 deletions tests/data/channels/recipes/shortcuts_channel_1/2/Menu/menu.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"$schema": "https://json-schema.org/draft-07/schema",
"$id": "https://schemas.conda.io/menuinst-1.schema.json",
"menu_name": "pixi-editor",
"menu_items": [
{
"name": {
"target_environment_is_base": "pixi-editor",
"target_environment_is_not_base": "pixi-editor ({{ ENV_NAME }})"
},
"description": "Pixi Editor 2",
"icon": "{{ MENU_DIR }}/pixi-icon.{{ ICON_EXT }}",
"activate": false,
"terminal": false,
"command": [""],
"platforms": {
"win": {
"desktop": true,
"app_user_model_id": "dev.prefix.pixi-editor",
"command": ["notepad.exe", "%*"],
"file_extensions": [".pixi"]
},
"linux": {
"Categories": ["Development", "Science"],
"command": ["gedit", "%F"],
"MimeType": ["text/x-pixi"]
},
"osx": {
"command": ["open", "-a", "TextEdit"],
"CFBundleName": "Pixi Editor",
"CFBundleIdentifier": "dev.prefix.pixi-editor",
"CFBundleVersion": "0.1.0",
"CFBundleDocumentTypes": [
{
"CFBundleTypeName": "text document",
"CFBundleTypeRole": "Editor",
"LSHandlerRank": "Default",
"CFBundleTypeIconFile": "pixi-icon.icns",
"LSItemContentTypes": ["public.pixi"]
}
]
}
}
}
]
}
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading