diff options
author | Alex Crichton <alex@alexcrichton.com> | 2015-03-07 11:51:17 -0800 |
---|---|---|
committer | Alex Crichton <alex@alexcrichton.com> | 2015-03-07 11:51:17 -0800 |
commit | 80b4350918a236711ed193c06998ddc1af523e17 (patch) | |
tree | a30065aece8a6f679c79d430f2465a30e0d97769 | |
parent | c3cdbc762c1b35bd260044870e655e06c75e738c (diff) | |
download | ssh2-rs-80b4350918a236711ed193c06998ddc1af523e17.zip |
Update to rust master
-rw-r--r-- | Cargo.toml | 3 | ||||
-rw-r--r-- | libssh2-sys/build.rs | 15 | ||||
-rw-r--r-- | src/lib.rs | 2 | ||||
-rw-r--r-- | tests/all.rs | 3 | ||||
-rw-r--r-- | tests/session.rs | 3 | ||||
-rw-r--r-- | tests/sftp.rs | 6 |
6 files changed, 19 insertions, 13 deletions
@@ -23,3 +23,6 @@ libc = "0.1" [dependencies.libssh2-sys] path = "libssh2-sys" version = "0.1.0" + +[dev-dependencies] +tempdir = "0.3" diff --git a/libssh2-sys/build.rs b/libssh2-sys/build.rs index fcdcb12..d6e18ec 100644 --- a/libssh2-sys/build.rs +++ b/libssh2-sys/build.rs @@ -1,10 +1,9 @@ -#![feature(io, path, core, fs)] +#![feature(path, fs_walk)] extern crate "pkg-config" as pkg_config; use std::env; use std::fs; -use std::io::prelude::*; use std::path::PathBuf; use std::process::Command; @@ -21,7 +20,7 @@ fn main() { if target.contains("i686") { cflags.push_str(" -m32"); - } else if target.as_slice().contains("x86_64") { + } else if target.contains("x86_64") { cflags.push_str(" -m64"); } if !target.contains("i686") { @@ -30,8 +29,8 @@ fn main() { match env::var("DEP_OPENSSL_ROOT") { Ok(s) => { - cflags.push_str(format!(" -I{}/include", s).as_slice()); - cflags.push_str(format!(" -L{}/lib", s).as_slice()); + cflags.push_str(&format!(" -I{}/include", s)); + cflags.push_str(&format!(" -L{}/lib", s)); } Err(..) => {} } @@ -81,7 +80,7 @@ fn main() { // Which one does windows generate? Who knows! let p1 = dst.join("build/src/.libs/libssh2.a"); let p2 = dst.join("build/src/.libs/libssh2.lib"); - if p1.exists() { + if fs::metadata(&p1).is_ok() { fs::rename(&p1, &dst.join("lib/libssh2.a")).unwrap(); } else { fs::rename(&p2, &dst.join("lib/libssh2.a")).unwrap(); @@ -94,7 +93,7 @@ fn main() { let dst = dst.join("include"); for file in fs::walk_dir(&root).unwrap() { let file = file.unwrap().path(); - if !file.is_file() { continue } + if fs::metadata(&file).map(|m| m.is_file()) != Ok(true) { continue } let part = file.relative_from(&root).unwrap(); let dst = dst.join(part); @@ -124,5 +123,5 @@ fn which(cmd: &str) -> Option<PathBuf> { let cmd = format!("{}{}", cmd, env::consts::EXE_SUFFIX); env::split_paths(&env::var("PATH").unwrap()).map(|p| { p.join(&cmd) - }).find(|p| p.exists()) + }).find(|p| fs::metadata(p).is_ok()) } @@ -124,7 +124,7 @@ //! ``` #![doc(html_root_url = "http://alexcrichton.com/ssh2-rs")] -#![feature(unsafe_destructor, std_misc, collections, io, core, path, os, net)] +#![feature(unsafe_destructor, std_misc, collections, io, core, path, net)] #![deny(missing_docs, unused_results)] #![cfg_attr(test, deny(warnings))] diff --git a/tests/all.rs b/tests/all.rs index 3da9813..ed900f0 100644 --- a/tests/all.rs +++ b/tests/all.rs @@ -1,8 +1,9 @@ #![deny(warnings)] -#![feature(io, core, path, net, fs, tempdir)] +#![feature(io, core, path, net)] extern crate ssh2; extern crate libc; +extern crate tempdir; use std::env; use std::net::TcpStream; diff --git a/tests/session.rs b/tests/session.rs index fbfadfc..36f8c7c 100644 --- a/tests/session.rs +++ b/tests/session.rs @@ -1,7 +1,8 @@ use std::env; -use std::fs::{File, TempDir}; +use std::fs::File; use std::io::prelude::*; use std::path::{Path, PathBuf}; +use tempdir::TempDir; use ssh2::{Session, MethodType, HashType}; diff --git a/tests/sftp.rs b/tests/sftp.rs index 774ba86..b28e549 100644 --- a/tests/sftp.rs +++ b/tests/sftp.rs @@ -1,5 +1,6 @@ use std::io::prelude::*; -use std::fs::{self, File, TempDir}; +use std::fs::{self, File}; +use tempdir::TempDir; #[test] fn smoke() { @@ -18,7 +19,8 @@ fn ops() { sftp.opendir(&td.path().join("bar")).unwrap(); let mut foo = sftp.open(&td.path().join("foo")).unwrap(); sftp.mkdir(&td.path().join("bar2"), 0o755).unwrap(); - assert!(td.path().join("bar2").is_dir()); + assert_eq!(fs::metadata(&td.path().join("bar2")).map(|m| m.is_dir()), + Ok(true)); sftp.rmdir(&td.path().join("bar2")).unwrap(); sftp.create(&td.path().join("foo5")).unwrap().write_all(b"foo").unwrap(); |