Skip to content

Commit 20a085e

Browse files
committed
Auto merge of #3996 - alexcrichton:rustup-up, r=alexcrichton
Upgrade rustup used on AppVeyor
2 parents bc6fda5 + d869907 commit 20a085e

File tree

2 files changed

+20
-30
lines changed

2 files changed

+20
-30
lines changed

appveyor.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ install:
2828
- if defined MINGW_URL 7z x -y %MINGW_ARCHIVE% > nul
2929
- if defined MINGW_URL set PATH=%CD%\%MINGW_DIR%\bin;C:\msys64\usr\bin;%PATH%
3030

31-
# FIXME(#3394) use master rustup
32-
- curl -sSfO https://static.rust-lang.org/rustup/archive/0.6.5/x86_64-pc-windows-msvc/rustup-init.exe
31+
- appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
3332
- rustup-init.exe -y --default-host x86_64-pc-windows-msvc --default-toolchain nightly-2017-03-03
3433
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin
3534
- if NOT "%TARGET%" == "x86_64-pc-windows-msvc" rustup target add %TARGET%

tests/cargotest/lib.rs

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@ extern crate url;
1818
#[cfg(windows)] extern crate kernel32;
1919
#[cfg(windows)] extern crate winapi;
2020

21-
use cargo::util::Rustc;
2221
use std::ffi::OsStr;
2322
use std::time::Duration;
24-
use std::path::PathBuf;
25-
use std::env;
23+
use std::path::{Path, PathBuf};
24+
25+
use cargo::util::Rustc;
26+
use cargo::util::paths;
2627

2728
pub mod support;
2829
pub mod install;
@@ -69,31 +70,21 @@ fn _process(t: &OsStr) -> cargo::util::ProcessBuilder {
6970

7071
// We'll need dynamic libraries at some point in this test suite, so ensure
7172
// that the rustc libdir is somewhere in LD_LIBRARY_PATH as appropriate.
72-
// Note that this isn't needed on Windows as we assume the bindir (with
73-
// dlls) is in PATH.
74-
if cfg!(unix) {
75-
let var = if cfg!(target_os = "macos") {
76-
"DYLD_LIBRARY_PATH"
77-
} else {
78-
"LD_LIBRARY_PATH"
79-
};
80-
let rustc = RUSTC.with(|r| r.path.clone());
81-
let path = env::var_os("PATH").unwrap_or(Default::default());
82-
let rustc = env::split_paths(&path)
83-
.map(|p| p.join(&rustc))
84-
.find(|p| p.exists())
85-
.unwrap();
86-
let mut libdir = rustc.clone();
87-
libdir.pop();
88-
libdir.pop();
89-
libdir.push("lib");
90-
let prev = env::var_os(&var).unwrap_or(Default::default());
91-
let mut paths = env::split_paths(&prev).collect::<Vec<_>>();
92-
println!("libdir: {:?}", libdir);
93-
if !paths.contains(&libdir) {
94-
paths.push(libdir);
95-
p.env(var, env::join_paths(&paths).unwrap());
96-
}
73+
let mut rustc = RUSTC.with(|r| r.process());
74+
let output = rustc.arg("--print").arg("sysroot").exec_with_output().unwrap();
75+
let libdir = String::from_utf8(output.stdout).unwrap();
76+
let libdir = Path::new(libdir.trim());
77+
let libdir = if cfg!(windows) {
78+
libdir.join("bin")
79+
} else {
80+
libdir.join("lib")
81+
};
82+
let mut paths = paths::dylib_path();
83+
println!("libdir: {:?}", libdir);
84+
if !paths.contains(&libdir) {
85+
paths.push(libdir);
86+
p.env(paths::dylib_path_envvar(),
87+
paths::join_paths(&paths, paths::dylib_path_envvar()).unwrap());
9788
}
9889
return p
9990
}

0 commit comments

Comments
 (0)