Skip to content

Commit

Permalink
Fix failing cargo fmt and ruff CI jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
Owen-CH-Leung committed Aug 13, 2024
1 parent 7b76520 commit 136fee2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
1 change: 0 additions & 1 deletion maturin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import struct
import subprocess
import sys
from subprocess import SubprocessError
from typing import Any, Dict, Mapping, List, Optional

try:
Expand Down
2 changes: 1 addition & 1 deletion src/build_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1187,7 +1187,7 @@ impl BuildContext {
{
let current_path = env::var("PATH").unwrap_or_default();
let new_path = format!("{}:{}", cargo_bin_path.display(), current_path);
unsafe {env::set_var("PATH", &new_path)};
unsafe { env::set_var("PATH", &new_path) };
Command::new(cargo_bin_path.join("rustup"))
.arg("default")
.arg("stable")
Expand Down
15 changes: 9 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ use clap::CommandFactory;
use clap::{Parser, Subcommand};
#[cfg(feature = "rustls")]
use dirs::home_dir;
#[cfg(feature = "rustls")]
use maturin::BuildContext;
#[cfg(feature = "scaffolding")]
use maturin::{ci::GenerateCI, init_project, new_project, GenerateProjectOptions};
use maturin::{
develop, write_dist_info, BridgeModel, BuildOptions, CargoOptions,
DevelopOptions, PathWriter, PlatformTag, PythonInterpreter, Target,
develop, write_dist_info, BridgeModel, BuildOptions, CargoOptions, DevelopOptions, PathWriter,
PlatformTag, PythonInterpreter, Target,
};
#[cfg(feature = "rustls")]
use maturin::BuildContext;
#[cfg(feature = "schemars")]
use maturin::{generate_json_schema, GenerateJsonSchemaOptions};
#[cfg(feature = "upload")]
Expand Down Expand Up @@ -280,10 +280,13 @@ fn pep517(subcommand: Pep517Command) -> Result<()> {
#[cfg(feature = "rustls")]
if !BuildContext::is_toolchain_installed() {
let home_dir = home_dir().context("Unabel to get user home directory")?;
let home_dir_str = home_dir.to_str().context("Unable to convert home directory string")?;
let home_dir_str = home_dir
.to_str()
.context("Unable to convert home directory string")?;
BuildContext::download_and_execute_rustup(home_dir_str, home_dir_str)
.context("Unable to install & execute rustup")?;
BuildContext::add_cargo_to_path(home_dir_str).context("Unable to add cargo path")?;
BuildContext::add_cargo_to_path(home_dir_str)
.context("Unable to add cargo path")?;
}
let context = build_options.into_build_context(true, strip, false)?;

Expand Down

0 comments on commit 136fee2

Please sign in to comment.