mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-23 21:23:20 +00:00
Pass themes folder as parameter
This commit is contained in:
parent
51580d46f9
commit
b1b11d4589
@ -451,7 +451,9 @@ impl Step for RustdocTheme {
|
||||
fn run(self, builder: &Builder) {
|
||||
let rustdoc = builder.rustdoc(self.compiler.host);
|
||||
let mut cmd = Command::new(builder.config.python.clone().expect("python not defined"));
|
||||
cmd.args(&["src/tools/rustdoc-themes/test-themes.py", rustdoc.to_str().unwrap()]);
|
||||
cmd.args(&[builder.src.join("src/tools/rustdoc-themes/test-themes.py").to_str().unwrap(),
|
||||
rustdoc.to_str().unwrap(),
|
||||
builder.src.join("src/librustdoc/html/static/themes").to_str().unwrap()]);
|
||||
cmd.env("RUSTC_STAGE", self.compiler.stage.to_string())
|
||||
.env("RUSTC_SYSROOT", builder.sysroot(self.compiler))
|
||||
.env("RUSTDOC_LIBDIR", builder.sysroot_libdir(self.compiler, self.compiler.host))
|
||||
|
@ -332,10 +332,10 @@ pub fn main_args(args: &[String]) -> isize {
|
||||
print!(" - Checking \"{}\"...", theme_file);
|
||||
let (success, differences) = theme::test_theme_against(theme_file, &paths);
|
||||
if !differences.is_empty() || !success {
|
||||
eprintln!(" FAILED");
|
||||
println!(" FAILED");
|
||||
errors += 1;
|
||||
if !differences.is_empty() {
|
||||
eprintln!("{}", differences.join("\n"));
|
||||
println!("{}", differences.join("\n"));
|
||||
}
|
||||
} else {
|
||||
println!(" OK");
|
||||
@ -407,13 +407,13 @@ pub fn main_args(args: &[String]) -> isize {
|
||||
.iter()
|
||||
.map(|s| (PathBuf::from(&s), s.to_owned())) {
|
||||
if !theme_file.is_file() {
|
||||
eprintln!("rustdoc: option --themes arguments must all be files");
|
||||
println!("rustdoc: option --themes arguments must all be files");
|
||||
return 1;
|
||||
}
|
||||
let (success, ret) = theme::test_theme_against(&theme_file, &paths);
|
||||
if !success || !ret.is_empty() {
|
||||
eprintln!("rustdoc: invalid theme: \"{}\"", theme_s);
|
||||
eprintln!(" Check what's wrong with the \"theme-checker\" option");
|
||||
println!("rustdoc: invalid theme: \"{}\"", theme_s);
|
||||
println!(" Check what's wrong with the \"theme-checker\" option");
|
||||
return 1;
|
||||
}
|
||||
themes.push(theme_file);
|
||||
|
@ -348,7 +348,7 @@ c // sdf
|
||||
d {}
|
||||
"#;
|
||||
let paths = load_css_paths(text.as_bytes());
|
||||
assert!(paths.children.get(&CssPath::new("a b c d".to_owned())).is_some());
|
||||
assert!(paths.children.contains(&CssPath::new("a b c d".to_owned())));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -17,7 +17,6 @@ import subprocess
|
||||
import sys
|
||||
|
||||
FILES_TO_IGNORE = ['main.css']
|
||||
THEME_DIR_PATH = "src/librustdoc/html/static/themes"
|
||||
|
||||
|
||||
def print_err(msg):
|
||||
@ -31,14 +30,15 @@ def exec_command(command):
|
||||
|
||||
|
||||
def main(argv):
|
||||
if len(argv) < 1:
|
||||
if len(argv) < 2:
|
||||
print_err("Needs rustdoc binary path")
|
||||
return 1
|
||||
rustdoc_bin = argv[0]
|
||||
themes = [join(THEME_DIR_PATH, f) for f in listdir(THEME_DIR_PATH)
|
||||
if isfile(join(THEME_DIR_PATH, f)) and f not in FILES_TO_IGNORE]
|
||||
themes_folder = argv[1]
|
||||
themes = [join(themes_folder, f) for f in listdir(themes_folder)
|
||||
if isfile(join(themes_folder, f)) and f not in FILES_TO_IGNORE]
|
||||
if len(themes) < 1:
|
||||
print_err('No theme found in "{}"...'.format(THEME_DIR_PATH))
|
||||
print_err('No theme found in "{}"...'.format(themes_folder))
|
||||
return 1
|
||||
args = [rustdoc_bin, '-Z', 'unstable-options', '--theme-checker']
|
||||
args.extend(themes)
|
||||
|
Loading…
Reference in New Issue
Block a user