Skip to content

Commit

Permalink
fix Python shebang
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfv committed Oct 2, 2024
1 parent 080a7be commit d6ffb67
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions crates/rattler-bin/src/commands/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ pub async fn create(opt: Opt) -> anyhow::Result<()> {
let target_prefix = opt
.target_prefix
.unwrap_or_else(|| current_dir.join(".prefix"));

// Make the target prefix absolute
let target_prefix = std::path::absolute(target_prefix)?;
println!("Target prefix: {}", target_prefix.display());

// Determine the platform we're going to install for
Expand Down
6 changes: 5 additions & 1 deletion crates/rattler/src/install/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -591,8 +591,12 @@ fn replace_shebang<'a>(
shebang

Check warning on line 591 in crates/rattler/src/install/link.rs

View workflow job for this annotation

GitHub Actions / Format and Lint

Diff in /home/runner/work/rattler/rattler/crates/rattler/src/install/link.rs

Check warning on line 591 in crates/rattler/src/install/link.rs

View workflow job for this annotation

GitHub Actions / Format, Lint and Test the Python bindings

Diff in /home/runner/work/rattler/rattler/crates/rattler/src/install/link.rs
);


if old_new.1.contains(' ') {
return convert_shebang_to_env(shebang);
// we convert the shebang without spaces to a new shebang, and only then replace
// which is relevant for the Python case
let new_shebang = convert_shebang_to_env(shebang).replace(old_new.0, old_new.1);
return new_shebang.into();
}

let shebang: Cow<'_, str> = shebang.replace(old_new.0, old_new.1).into();
Expand Down

0 comments on commit d6ffb67

Please sign in to comment.