Skip to content

Commit

Permalink
win32: look for python.exe and variants on win32 in style/build.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
vvuk authored and larsbergstrom committed Jan 20, 2016
1 parent 5e136d6 commit 77aea59
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions components/style/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,32 @@ use std::io::Write;
use std::path::Path;
use std::process::{Command, Stdio, exit};

#[cfg(windows)]
fn find_python() -> String {
if Command::new("python27.exe").arg("--version").output().is_ok() {
return "python27.exe".to_owned();
}

fn main() {
let python = if Command::new("python2.7").arg("--version").output().unwrap().status.success() {
if Command::new("python.exe").arg("--version").output().is_ok() {
return "python.exe".to_owned();
}

panic!("Can't find python (tried python27.exe and python.exe)! Try fixing PATH or setting the PYTHON env var");
}

#[cfg(not(windows))]
fn find_python() -> String {
if Command::new("python2.7").arg("--version").output().unwrap().status.success() {
"python2.7"
} else {
"python"
}.to_owned()
}

fn main() {
let python = match env::var("PYTHON") {
Ok(python_path) => python_path,
Err(_) => find_python(),
};
let style = Path::new(file!()).parent().unwrap();
let mako = style.join("Mako-0.9.1.zip");
Expand Down

0 comments on commit 77aea59

Please sign in to comment.