Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 9f80c1d

Browse files
committed
run_make_support: move external deps to external_deps module
1 parent 7e12dc0 commit 9f80c1d

File tree

10 files changed

+49
-24
lines changed

10 files changed

+49
-24
lines changed

src/tools/run-make-support/src/env_checked.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use std::ffi::OsString;
21
use std::env;
2+
use std::ffi::OsString;
33

44
#[track_caller]
55
#[must_use]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
use crate::command::Command;
2+
use crate::source_root;
3+
4+
use super::python::python_command;
5+
6+
/// `htmldocck` is a python script which is used for rustdoc test suites, it is assumed to be
7+
/// available at `$SOURCE_ROOT/src/etc/htmldocck.py`.
8+
#[track_caller]
9+
#[must_use]
10+
pub fn htmldocck() -> Command {
11+
let mut python = python_command();
12+
python.arg(source_root().join("src/etc/htmldocck.py"));
13+
python
14+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//! This module contains external tool dependencies that we assume are available in the environment,
2+
//! such as `cc` or `python`.
3+
4+
pub mod cc;
5+
pub mod clang;
6+
pub mod htmldocck;
7+
pub mod llvm;
8+
pub mod python;
9+
pub mod rustc;
10+
pub mod rustdoc;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
use crate::command::Command;
2+
use crate::env_checked::env_var;
3+
4+
/// Obtain path of python as provided by the `PYTHON` environment variable. It is up to the caller
5+
/// to document and check if the python version is compatible with its intended usage.
6+
#[track_caller]
7+
#[must_use]
8+
pub fn python_command() -> Command {
9+
let python_path = env_var("PYTHON");
10+
Command::new(python_path)
11+
}

src/tools/run-make-support/src/lib.rs

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,13 @@
33
//! notably is built via cargo: this means that if your test wants some non-trivial utility, such
44
//! as `object` or `wasmparser`, they can be re-exported and be made available through this library.
55
6-
pub mod cc;
7-
pub mod clang;
86
mod command;
97
pub mod diff;
108
pub mod env_checked;
9+
pub mod external_deps;
1110
pub mod fs_wrapper;
12-
pub mod llvm;
1311
mod macros;
1412
pub mod run;
15-
pub mod rustc;
16-
pub mod rustdoc;
1713
pub mod targets;
1814

1915
use std::fs;
@@ -27,17 +23,26 @@ pub use object;
2723
pub use regex;
2824
pub use wasmparser;
2925

26+
// Re-exports of external dependencies.
27+
pub use external_deps::{cc, clang, htmldocck, llvm, python, rustc, rustdoc};
28+
3029
pub use cc::{cc, extra_c_flags, extra_cxx_flags, Cc};
3130
pub use clang::{clang, Clang};
32-
pub use diff::{diff, Diff};
33-
pub use env_checked::{env_var, env_var_os};
31+
pub use htmldocck::htmldocck;
3432
pub use llvm::{
3533
llvm_filecheck, llvm_objdump, llvm_profdata, llvm_readobj, LlvmFilecheck, LlvmObjdump,
3634
LlvmProfdata, LlvmReadobj,
3735
};
38-
pub use run::{cmd, run, run_fail, run_with_args};
36+
pub use python::python_command;
3937
pub use rustc::{aux_build, bare_rustc, rustc, Rustc};
4038
pub use rustdoc::{bare_rustdoc, rustdoc, Rustdoc};
39+
40+
pub use diff::{diff, Diff};
41+
42+
pub use env_checked::{env_var, env_var_os};
43+
44+
pub use run::{cmd, run, run_fail, run_with_args};
45+
4146
pub use targets::{is_darwin, is_msvc, is_windows, target, uname};
4247

4348
use command::{Command, CompletedProcess};
@@ -55,21 +60,6 @@ pub fn ar(inputs: &[impl AsRef<Path>], output_path: impl AsRef<Path>) {
5560
}
5661
}
5762

58-
#[track_caller]
59-
#[must_use]
60-
pub fn python_command() -> Command {
61-
let python_path = env_var("PYTHON");
62-
Command::new(python_path)
63-
}
64-
65-
#[track_caller]
66-
#[must_use]
67-
pub fn htmldocck() -> Command {
68-
let mut python = python_command();
69-
python.arg(source_root().join("src/etc/htmldocck.py"));
70-
python
71-
}
72-
7363
/// Returns the path for a local test file.
7464
pub fn path<P: AsRef<Path>>(p: P) -> PathBuf {
7565
cwd().join(p.as_ref())

0 commit comments

Comments
 (0)