Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Detect python2.7.exe on windows
Latest python2 package on msys2 installs the executable file to
python2.7.exe rather than python27.exe.
  • Loading branch information
upsuper committed Jul 8, 2016
1 parent bc45f85 commit 6389107
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion components/style/build.rs
Expand Up @@ -11,6 +11,10 @@ use walkdir::WalkDir;

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

if Command::new("python27.exe").arg("--version").output().is_ok() {
return "python27.exe".to_owned();
}
Expand All @@ -19,7 +23,8 @@ fn find_python() -> String {
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");
panic!(concat!("Can't find python (tried python2.7.exe, python27.exe, and python.exe)! ",
"Try fixing PATH or setting the PYTHON env var"));
}

#[cfg(not(windows))]
Expand Down
7 changes: 6 additions & 1 deletion ports/geckolib/build.rs
Expand Up @@ -8,6 +8,10 @@ use std::process::{Command, exit};

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

if Command::new("python27.exe").arg("--version").output().is_ok() {
return "python27.exe".to_owned();
}
Expand All @@ -16,7 +20,8 @@ fn find_python() -> String {
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");
panic!(concat!("Can't find python (tried python2.7.exe, python27.exe, and python.exe)! ",
"Try fixing PATH or setting the PYTHON env var"));
}

#[cfg(not(windows))]
Expand Down

0 comments on commit 6389107

Please sign in to comment.