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

feat: Allow to specify custom version during build #2322

Merged
merged 1 commit into from
Oct 25, 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
5 changes: 4 additions & 1 deletion crates/pixi_consts/src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ pub const PYPROJECT_MANIFEST: &str = "pyproject.toml";
pub const PROJECT_LOCK_FILE: &str = "pixi.lock";
pub const CONFIG_FILE: &str = "config.toml";
pub const PIXI_DIR: &str = ".pixi";
pub const PIXI_VERSION: &str = "0.34.0";
pub const PIXI_VERSION: &str = match option_env!("PIXI_VERSION") {
Some(v) => v,
None => "0.34.0",
};
pub const PREFIX_FILE_NAME: &str = "pixi_env_prefix";
pub const ENVIRONMENTS_DIR: &str = "envs";
pub const SOLVE_GROUP_ENVIRONMENTS_DIR: &str = "solve-group-envs";
Expand Down
8 changes: 8 additions & 0 deletions docs/packaging.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ the user to the package manager they should be using to update pixi.
PIXI_SELF_UPDATE_DISABLED_MESSAGE="`self-update` has been disabled for this build. Run `brew upgrade pixi` instead" cargo build --locked --profile dist
```

#### Custom version

You can specify a custom version string to be used in the `--version` output by setting the `PIXI_VERSION` environment variable during the build.

```shell
PIXI_VERSION="HEAD-123456" cargo build --locked --profile dist
```

## Shell completion

After building pixi you can generate shell autocompletion scripts by running
Expand Down
9 changes: 5 additions & 4 deletions src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use clap::Parser;
use clap_verbosity_flag::Verbosity;
use indicatif::ProgressDrawTarget;
use miette::IntoDiagnostic;
use pixi_consts::consts;
use tracing_subscriber::{
filter::LevelFilter, prelude::__tracing_subscriber_SubscriberExt, util::SubscriberInitExt,
EnvFilter,
Expand Down Expand Up @@ -39,9 +40,9 @@ pub mod upload;

#[derive(Parser, Debug)]
#[command(
version,
about = "
Pixi [version 0.34.0] - Developer Workflow and Environment Management for Multi-Platform, Language-Agnostic Projects.
version(consts::PIXI_VERSION),
about = format!("
Pixi [version {}] - Developer Workflow and Environment Management for Multi-Platform, Language-Agnostic Projects.
Pixi is a versatile developer workflow tool designed to streamline the management of your project's dependencies, tasks, and environments.
Built on top of the Conda ecosystem, Pixi offers seamless integration with the PyPI ecosystem.
Expand All @@ -62,7 +63,7 @@ Need Help?
Ask a question on the Prefix Discord server: https://discord.gg/kKV8ZxyzY4
For more information, see the documentation at: https://pixi.sh
"
", consts::PIXI_VERSION)
)]
#[clap(arg_required_else_help = true)]
struct Args {
Expand Down
6 changes: 1 addition & 5 deletions tbump.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,12 @@ src = "install/install.sh"
search = "Version: v{current_version}"
src = "install/install.ps1"

[[file]]
search = "version {current_version}"
src = "src/cli/mod.rs"

[[file]]
search = "PIXI_VERSION = \"{current_version}\""
src = "tests/integration/common.py"

[[file]]
search = "pub const PIXI_VERSION: &str = \"{current_version}\";"
search = "None => \"{current_version}\","
src = "crates/pixi_consts/src/consts.rs"

[[field]]
Expand Down
Loading