Auto merge of #12338 - upsuper:win-geckolib-fix, r=bholley

Fix geckolib build for Windows

It contains several fixes to make `./mach build-geckolib` work on Windows.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12338)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-07-08 11:14:48 -07:00 committed by GitHub
commit 35a23bfef3
4 changed files with 15 additions and 4 deletions

View file

@ -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();
}
@ -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))]

View file

@ -6,7 +6,7 @@ import json
import os.path
import sys
BASE = os.path.dirname(__file__)
BASE = os.path.dirname(__file__.replace('\\', '/'))
sys.path.insert(0, os.path.join(BASE, "Mako-0.9.1.zip"))
sys.path.insert(0, BASE) # For importing `data.py`

View file

@ -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();
}
@ -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))]

View file

@ -368,9 +368,10 @@ class MachCommands(CommandBase):
opts += ["--release"]
build_start = time()
env = self.build_env()
with cd(path.join("ports", "geckolib")):
ret = call(["cargo", "build"] + opts,
env=self.build_env(), verbose=verbose)
env=env, verbose=verbose)
elapsed = time() - build_start
# Generate Desktop Notification if elapsed-time > some threshold value