aboutsummaryrefslogtreecommitdiffstats
path: root/components/style/build.rs
diff options
context:
space:
mode:
authorVladimir Vukicevic <vladimir@pobox.com>2015-10-05 12:08:11 -0400
committerLars Bergstrom <lars@lars.com>2016-01-20 08:38:23 -0600
commit77aea599c76278d7efd92efbdae8392d7e93a832 (patch)
tree23a9335aefa6ecbd112d29f6c7c72b0f7bbcb03a /components/style/build.rs
parent5e136d6dd5bd27eb23d431014a176a72c9b5f01a (diff)
downloadservo-77aea599c76278d7efd92efbdae8392d7e93a832.tar.gz
servo-77aea599c76278d7efd92efbdae8392d7e93a832.zip
win32: look for python.exe and variants on win32 in style/build.rs
Diffstat (limited to 'components/style/build.rs')
-rw-r--r--components/style/build.rs24
1 files changed, 22 insertions, 2 deletions
diff --git a/components/style/build.rs b/components/style/build.rs
index 40bdc32b062..919c9959b67 100644
--- a/components/style/build.rs
+++ b/components/style/build.rs
@@ -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");