Skip to content

Commit

Permalink
Update fix-python
Browse files Browse the repository at this point in the history
  • Loading branch information
Omid Ghaffarinia committed Oct 27, 2020
1 parent 2786c43 commit 763f310
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ fn run_make(rule: &str, cwd: &Path) -> bool {
}

fn fix_python_version() -> Option<()> {
let output = Command::new("python").arg("-V").output().ok()?;
let python_version = String::from_utf8_lossy(&output.stdout).to_string();
if !Regex::new("Python 2.*")
.ok()?
.is_match(python_version.as_str())
{
if if let Ok(output) = Command::new("python").arg("-V").output() {
let python_version = String::from_utf8_lossy(&output.stdout).to_string();
!Regex::new("Python 2.*")
.ok()?
.is_match(python_version.as_str())
} else {
true
} {
let cwd = env::current_dir().ok()?;
if !run_make("fix-python", cwd.as_path()) {
return None;
Expand Down

0 comments on commit 763f310

Please sign in to comment.