Skip to content

Commit

Permalink
Run cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Jul 28, 2024
1 parent 5a38a6c commit 5508f23
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
4 changes: 2 additions & 2 deletions crates/install-wheel-rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ use zip::result::ZipError;
use pep440_rs::Version;
use platform_tags::{Arch, Os};
use pypi_types::Scheme;
pub use uninstall::{Uninstall, uninstall_egg, uninstall_legacy_editable, uninstall_wheel};
pub use uninstall::{uninstall_egg, uninstall_legacy_editable, uninstall_wheel, Uninstall};
use uv_fs::Simplified;
use uv_normalize::PackageName;
pub use wheel::{LibKind, parse_wheel_file, read_record_file};
pub use wheel::{parse_wheel_file, read_record_file, LibKind};

pub mod linker;
pub mod metadata;
Expand Down
23 changes: 12 additions & 11 deletions crates/install-wheel-rs/src/wheel.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use std::collections::HashMap;
use std::io::{BufRead, BufReader, Cursor, Read, Seek, Write};
use std::path::{Path, PathBuf};
use std::{env, io};
use std::borrow::Cow;
use data_encoding::BASE64URL_NOPAD;
use fs_err as fs;
use fs_err::{DirEntry, File};
use rustc_hash::FxHashMap;
use sha2::{Digest, Sha256};
use std::borrow::Cow;
use std::collections::HashMap;
use std::io::{BufRead, BufReader, Cursor, Read, Seek, Write};
use std::path::{Path, PathBuf};
use std::{env, io};
use tracing::{instrument, warn};
use walkdir::WalkDir;
use zip::write::FileOptions;
Expand Down Expand Up @@ -299,11 +299,9 @@ pub(crate) fn write_script_entrypoints(
))
})?;


// Generate the launcher script.
let python_executable = get_python_executable(layout, relocatable)?;
let launcher_executable =
get_script_executable(&python_executable, is_gui);
let launcher_executable = get_script_executable(&python_executable, is_gui);
let launcher_python_script = get_script_launcher(
entrypoint,
&format_shebang(&launcher_executable, &layout.os_name, relocatable),
Expand Down Expand Up @@ -712,7 +710,10 @@ pub(crate) fn extra_dist_info(
///
/// Returns `sys.executable` if the wheel is not relocatable; otherwise, returns a path relative
/// to the scripts directory.
pub(crate) fn get_python_executable(layout: &Layout, relocatable: bool) -> Result<Cow<'_, Path>, Error> {
pub(crate) fn get_python_executable(
layout: &Layout,
relocatable: bool,
) -> Result<Cow<'_, Path>, Error> {
Ok(if relocatable {
Cow::Owned(
pathdiff::diff_paths(&layout.sys_executable, &layout.scheme.scripts).ok_or_else(
Expand Down Expand Up @@ -1076,13 +1077,13 @@ mod test {
// Truncate to a relative path.
let python_exe = python_exe.path().strip_prefix(temp_dir.path()).unwrap();

let script_path = get_script_executable(&python_exe ,true);
let script_path = get_script_executable(python_exe, true);
#[cfg(windows)]
assert_eq!(script_path, Path::new("pythonw.exe").to_path_buf());
#[cfg(not(windows))]
assert_eq!(script_path, Path::new("python.exe").to_path_buf());

let script_path = get_script_executable(&python_exe, false);
let script_path = get_script_executable(python_exe, false);
assert_eq!(script_path, Path::new("python.exe").to_path_buf());

Ok(())
Expand Down

0 comments on commit 5508f23

Please sign in to comment.