Skip to content

Commit

Permalink
Merge branch 'main' into build_spec_module
Browse files Browse the repository at this point in the history
  • Loading branch information
YeungOnion authored Sep 6, 2023
2 parents 8bb1cd8 + 31e0410 commit 27f6dfa
Show file tree
Hide file tree
Showing 26 changed files with 964 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-bindings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
name: Format, Lint and Test the Python bindings
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive
- run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/rust-compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
name: Check intra-doc links
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions-rust-lang/setup-rust-toolchain@v1
Expand All @@ -34,7 +34,7 @@ jobs:
name: Format and Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions-rust-lang/setup-rust-toolchain@v1
Expand Down Expand Up @@ -75,7 +75,7 @@ jobs:
# - { name: "Windows-aarch64", target: aarch64-pc-windows-msvc, os: windows-latest, skip-tests: true }
steps:
- name: Checkout source code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive
lfs: ${{ !matrix.skip-tests }}
Expand Down
4 changes: 2 additions & 2 deletions crates/rattler_conda_types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ pub use match_spec::parse::ParseMatchSpecError;
pub use match_spec::{MatchSpec, NamelessMatchSpec};
pub use no_arch_type::{NoArchKind, NoArchType};
pub use package_name::{InvalidPackageNameError, PackageName};
pub use platform::{ParsePlatformError, Platform};
pub use platform::{Arch, ParseArchError, ParsePlatformError, Platform};
pub use prefix_record::PrefixRecord;
pub use repo_data::patches::{PackageRecordPatch, PatchInstructions, RepoDataPatch};
pub use repo_data::{ChannelInfo, ConvertSubdirError, PackageRecord, RepoData};
pub use repo_data_record::RepoDataRecord;
pub use run_export::RunExportKind;
pub use version::{
Component, ParseVersionError, ParseVersionErrorKind, Version, VersionWithSource,
Component, ParseVersionError, ParseVersionErrorKind, StrictVersion, Version, VersionWithSource,
};
pub use version_spec::VersionSpec;

Expand Down
3 changes: 3 additions & 0 deletions crates/rattler_conda_types/src/platform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ impl Ord for Platform {
}

/// Known architectures supported by Conda.
#[allow(missing_docs)]
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]
pub enum Arch {
X86,
Expand Down Expand Up @@ -356,9 +357,11 @@ impl Arch {
}
}

/// An error that can occur when parsing an arch from a string.
#[derive(Debug, Error, Clone, Eq, PartialEq)]
#[error("'{string}' is not a known arch")]
pub struct ParseArchError {
/// The arch string that could not be parsed.
pub string: String,
}

Expand Down
4 changes: 4 additions & 0 deletions crates/rattler_shell/src/activation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,10 @@ impl<T: Shell + Clone> Activator<T> {
Ok(after_env
.into_iter()
.filter(|(key, value)| before_env.get(key) != Some(value))
// this happens on Windows for some reason
// @SET "=C:=C:\Users\robostack\Programs\pixi"
// @SET "=ExitCode=00000000"
.filter(|(key, _)| !key.is_empty())
.map(|(key, value)| (key.to_owned(), value.to_owned()))
.collect())
}
Expand Down
18 changes: 13 additions & 5 deletions crates/rattler_shell/src/shell/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,11 +350,11 @@ pub struct PowerShell {

impl Shell for PowerShell {
fn set_env_var(&self, f: &mut impl Write, env_var: &str, value: &str) -> std::fmt::Result {
writeln!(f, "$Env:{} = \"{}\"", env_var, value)
writeln!(f, "${{Env:{}}} = \"{}\"", env_var, value)
}

fn unset_env_var(&self, f: &mut impl Write, env_var: &str) -> std::fmt::Result {
writeln!(f, "$Env:{}=\"\"", env_var)
writeln!(f, "${{Env:{}}}=\"\"", env_var)
}

fn run_script(&self, f: &mut impl Write, path: &Path) -> std::fmt::Result {
Expand Down Expand Up @@ -489,15 +489,23 @@ impl ShellEnum {
let parent_process_name = parent_process.name().to_lowercase();

tracing::debug!(
"guessing ShellEnum. Parent process name: {}",
&parent_process_name
"Guessing ShellEnum. Parent process name: {} and args: {:?}",
&parent_process_name,
&parent_process.cmd()
);

if parent_process_name.contains("bash") {
Some(Bash.into())
} else if parent_process_name.contains("zsh") {
Some(Zsh.into())
} else if parent_process_name.contains("xonsh") {
} else if parent_process_name.contains("xonsh")
// xonsh is a python shell, so we need to check if the parent process is python and if it
// contains xonsh in the arguments.
|| (parent_process_name.contains("python")
&& parent_process
.cmd().iter()
.any(|arg| arg.contains("xonsh")))
{
Some(Xonsh.into())
} else if parent_process_name.contains("fish") {
Some(Fish.into())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
source: crates/rattler_shell/src/activation.rs
expression: script
---
$Env:PATH = "$Env:PATH:__PREFIX__/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin"
$Env:CONDA_PREFIX = "__PREFIX__"
${Env:PATH} = "$Env:PATH:__PREFIX__/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin"
${Env:CONDA_PREFIX} = "__PREFIX__"

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
source: crates/rattler_shell/src/activation.rs
expression: script
---
$Env:PATH = "__PREFIX__/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:$Env:PATH"
$Env:CONDA_PREFIX = "__PREFIX__"
${Env:PATH} = "__PREFIX__/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:$Env:PATH"
${Env:CONDA_PREFIX} = "__PREFIX__"

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
source: crates/rattler_shell/src/activation.rs
expression: script
---
$Env:PATH = "__PREFIX__/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin"
$Env:CONDA_PREFIX = "__PREFIX__"
${Env:PATH} = "__PREFIX__/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin"
${Env:CONDA_PREFIX} = "__PREFIX__"

Loading

0 comments on commit 27f6dfa

Please sign in to comment.