Fix build scripts warnings.

This commit is contained in:
Simon Sapin 2015-03-18 21:53:48 +01:00
parent 1e858ecbc6
commit fef279a8f5
3 changed files with 22 additions and 33 deletions

View file

@ -2,17 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#![feature(io)]
use std::old_io::process::{Command, ProcessExit, StdioContainer};
use std::process::Command;
fn main() {
let result = Command::new("make")
assert!(Command::new("make")
.args(&["-f", "makefile.cargo"])
.stdout(StdioContainer::InheritFd(1))
.stderr(StdioContainer::InheritFd(2))
.status()
.unwrap();
assert_eq!(result, ProcessExit::ExitStatus(0));
.unwrap()
.success());
}

View file

@ -2,32 +2,33 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#![feature(env, old_io, old_path)]
#![feature(io, path)]
use std::env;
use std::old_path::Path;
use std::old_io::process::{Command, ProcessExit, StdioContainer};
use std::old_io::File;
use std::fs::File;
use std::io::Write;
use std::process::{Command, Stdio};
use std::path::Path;
fn main() {
let python = if Command::new("python2.7").arg("--version").status() == Ok(ProcessExit::ExitStatus(0)) {
let python = if Command::new("python2.7").arg("--version").status().unwrap().success() {
"python2.7"
} else {
"python"
};
let style = Path::new(file!()).dir_path();
let style = Path::new(file!()).parent().unwrap();
let mako = style.join("Mako-0.9.1.zip");
let template = style.join("properties.mako.rs");
let result = Command::new(python)
.env("PYTHONPATH", mako.as_str().unwrap())
.env("TEMPLATE", template.as_str().unwrap())
.env("PYTHONPATH", &mako)
.env("TEMPLATE", &template)
.arg("-c")
.arg("from os import environ; from mako.template import Template; print(Template(filename=environ['TEMPLATE']).render())")
.stderr(StdioContainer::InheritFd(2))
.stderr(Stdio::inherit())
.output()
.unwrap();
assert_eq!(result.status, ProcessExit::ExitStatus(0));
let out = Path::new(env::var("OUT_DIR").unwrap());
File::create(&out.join("properties.rs")).unwrap().write_all(&*result.output).unwrap();
assert!(result.status.success());
let out = env::var("OUT_DIR").unwrap();
File::create(&Path::new(&out).join("properties.rs")).unwrap().write_all(&result.stdout).unwrap();
}

View file

@ -2,21 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#![feature(env)]
#![feature(io)]
#![feature(old_io)]
use std::old_io::process::{Command, ProcessExit, StdioContainer};
use std::process::Command;
use std::env;
fn main() {
let out_dir = env::var("OUT_DIR").unwrap();
let result = Command::new("make")
assert!(Command::new("make")
.args(&["-f", "makefile.cargo"])
.stdout(StdioContainer::InheritFd(1))
.stderr(StdioContainer::InheritFd(2))
.status()
.unwrap();
assert_eq!(result, ProcessExit::ExitStatus(0));
println!("cargo:rustc-flags=-L native={}", out_dir);
.unwrap()
.success());
println!("cargo:rustc-flags=-L native={}", env::var("OUT_DIR").unwrap());
}