Skip to content

Commit e9e7c50

Browse files
author
Alexander Regueiro
committed
cosmetic stuff
1 parent 8d67f57 commit e9e7c50

File tree

2 files changed

+25
-21
lines changed

2 files changed

+25
-21
lines changed

src/bootstrap/bootstrap.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def download(path, url, probably_big, verbose):
6666
def _download(path, url, probably_big, verbose, exception):
6767
if probably_big or verbose:
6868
print("downloading {}".format(url))
69-
# see http://serverfault.com/questions/301128/how-to-download
69+
# See http://serverfault.com/questions/301128/how-to-download.
7070
if sys.platform == 'win32':
7171
run(["PowerShell.exe", "/nologo", "-Command",
7272
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;",
@@ -79,7 +79,7 @@ def _download(path, url, probably_big, verbose, exception):
7979
else:
8080
option = "-s"
8181
run(["curl", option,
82-
"-y", "30", "-Y", "10", # timeout if speed is < 10 bytes/sec for > 30 seconds
82+
"-y", "30", "-Y", "10", # timeout if speed is < 10 bytes/sec for > 30 seconds
8383
"--connect-timeout", "30", # timeout if cannot connect within 30 seconds
8484
"--retry", "3", "-Sf", "-o", path, url],
8585
verbose=verbose,
@@ -131,7 +131,7 @@ def run(args, verbose=False, exception=False, **kwargs):
131131
if verbose:
132132
print("running: " + ' '.join(args))
133133
sys.stdout.flush()
134-
# Use Popen here instead of call() as it apparently allows powershell on
134+
# Use `Popen` here instead of `call()` as it apparently allows powershell on
135135
# Windows to not lock up waiting for input presumably.
136136
ret = subprocess.Popen(args, **kwargs)
137137
code = ret.wait()
@@ -660,6 +660,7 @@ def bootstrap_binary(self):
660660

661661
def build_bootstrap(self):
662662
"""Build bootstrap"""
663+
663664
build_dir = os.path.join(self.build_dir, "bootstrap")
664665
if self.clean and os.path.exists(build_dir):
665666
shutil.rmtree(build_dir)
@@ -680,7 +681,7 @@ def build_bootstrap(self):
680681
env["LIBRARY_PATH"] = os.path.join(self.bin_root(), "lib") + \
681682
(os.pathsep + env["LIBRARY_PATH"]) \
682683
if "LIBRARY_PATH" in env else ""
683-
# preserve existing RUSTFLAGS
684+
# Preserve existing `RUSTFLAGS`.
684685
env.setdefault("RUSTFLAGS", "")
685686
env["RUSTFLAGS"] += " -Cdebuginfo=2"
686687

@@ -748,7 +749,7 @@ def update_submodule(self, module, checked_out, recorded_submodules):
748749
"--init", "--recursive", "--progress", module],
749750
cwd=self.rust_root, verbose=self.verbose, exception=True)
750751
except RuntimeError:
751-
# Some versions of git don't support --progress.
752+
# Some versions of Git don't support `--progress`.
752753
run(["git", "submodule", "update",
753754
"--init", "--recursive", module],
754755
cwd=self.rust_root, verbose=self.verbose)
@@ -763,7 +764,7 @@ def update_submodules(self):
763764
self.get_toml('submodules') == "false":
764765
return
765766

766-
# check the existence of 'git' command
767+
# Check for the existence of the `git` executable.
767768
try:
768769
subprocess.check_output(['git', '--version'])
769770
except (subprocess.CalledProcessError, OSError):
@@ -878,7 +879,7 @@ def bootstrap(help_triggered):
878879
args = [a for a in sys.argv if a != '-h' and a != '--help']
879880
args, _ = parser.parse_known_args(args)
880881

881-
# Configure initial bootstrap
882+
# Configure initial bootstrap.
882883
build = RustBuild()
883884
build.rust_root = args.src or os.path.abspath(os.path.join(__file__, '../../..'))
884885
build.verbose = args.verbose
@@ -944,7 +945,7 @@ def main():
944945
"""Entry point for the bootstrap process"""
945946
start_time = time()
946947

947-
# x.py help <cmd> ...
948+
# `x.py help <cmd> ...`
948949
if len(sys.argv) > 1 and sys.argv[1] == 'help':
949950
sys.argv = [sys.argv[0], '-h'] + sys.argv[2:]
950951

src/bootstrap/sanity.rs

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Sanity checking performed by rustbuild before actually executing anything.
1+
//! Sanity-checking performed by rustbuild before actually executing anything.
22
//!
33
//! This module contains the implementation of ensuring that the build
44
//! environment looks reasonable before progressing. This will verify that
@@ -41,10 +41,10 @@ impl Finder {
4141
let mut cmd_exe = cmd.clone();
4242
cmd_exe.push(".exe");
4343

44-
if target.is_file() // some/path/git
45-
|| path.join(&cmd_exe).exists() // some/path/git.exe
44+
if target.is_file() // `some/path/git`
45+
|| path.join(&cmd_exe).exists() // `some/path/git.exe`
4646
|| target.join(&cmd_exe).exists()
47-
// some/path/git/git.exe
47+
// `some/path/git/git.exe`
4848
{
4949
return Some(target);
5050
}
@@ -68,7 +68,7 @@ pub fn check(build: &mut Build) {
6868
// being unable to identify the files properly. See
6969
// https://github.com/rust-lang/rust/issues/34959 for more details.
7070
if cfg!(windows) && path.to_string_lossy().contains('\"') {
71-
panic!("PATH contains invalid character '\"'");
71+
panic!("`PATH` contains invalid character '\"'");
7272
}
7373

7474
let mut cmd_finder = Finder::new();
@@ -78,7 +78,7 @@ pub fn check(build: &mut Build) {
7878
cmd_finder.must_have("git");
7979
}
8080

81-
// We need cmake, but only if we're actually building LLVM or sanitizers.
81+
// We need CMake, but only if we're actually building LLVM or sanitizers.
8282
let building_llvm = build
8383
.hosts
8484
.iter()
@@ -105,7 +105,7 @@ pub fn check(build: &mut Build) {
105105
}
106106
}
107107

108-
// If ninja isn't enabled but we're building for MSVC then we try
108+
// If Ninja isn't enabled but we're building for MSVC then we try
109109
// doubly hard to enable it. It was realized in #43767 that the msbuild
110110
// CMake generator for MSVC doesn't respect configuration options like
111111
// disabling LLVM assertions, which can often be quite important!
@@ -182,7 +182,7 @@ pub fn check(build: &mut Build) {
182182
// Externally configured LLVM requires FileCheck to exist
183183
let filecheck = build.llvm_filecheck(build.build);
184184
if !filecheck.starts_with(&build.out) && !filecheck.exists() && build.config.codegen_tests {
185-
panic!("FileCheck executable {:?} does not exist", filecheck);
185+
panic!("FileCheck executable `{:?}` does not exist", filecheck);
186186
}
187187

188188
for target in &build.targets {
@@ -210,13 +210,16 @@ pub fn check(build: &mut Build) {
210210
match build.musl_root(*target) {
211211
Some(root) => {
212212
if fs::metadata(root.join("lib/libc.a")).is_err() {
213-
panic!("couldn't find libc.a in musl dir: {}", root.join("lib").display());
213+
panic!(
214+
"couldn't find `libc.a` in musl dir: {}",
215+
root.join("lib").display()
216+
);
214217
}
215218
}
216219
None => panic!(
217-
"when targeting MUSL either the rust.musl-root \
218-
option or the target.$TARGET.musl-root option must \
219-
be specified in config.toml"
220+
"when targeting MUSL, either the `rust.musl-root` \
221+
option or the `target.$TARGET.musl-root` option must \
222+
be specified in `config.toml`"
220223
),
221224
}
222225
}
@@ -254,7 +257,7 @@ $ pacman -R cmake && pacman -S mingw-w64-x86_64-cmake
254257
if stage0.contains("\ndev:") {
255258
panic!(
256259
"bootstrapping from a dev compiler in a stable release, but \
257-
should only be bootstrapping from a released compiler!"
260+
should only be bootstrapping from a released compiler!"
258261
);
259262
}
260263
}

0 commit comments

Comments
 (0)