about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFelix S. Klock II <pnkfelix@pnkfx.org>2023-08-23 23:29:34 -0400
committerFelix S. Klock II <pnkfelix@pnkfx.org>2023-08-23 23:29:34 -0400
commitec2c95e0932312c994ee8c5d52b7ee93b5ae65b9 (patch)
tree9ab8100223b874aa72a1a5698226b8eea86608a7
parent3c6f4cc743316ff4b7f76a6492f78d6eb83dcf50 (diff)
downloadrust-ec2c95e0932312c994ee8c5d52b7ee93b5ae65b9.tar.gz
rust-ec2c95e0932312c994ee8c5d52b7ee93b5ae65b9.zip
Accommodate tidy.
In addition: Incorporated some review feedback (namely, removed a useless
initial assignment to True that was never read), and unified code a bit more
between bootstrap.py and download.rs (by using the same variable name for the
same concept).
-rw-r--r--src/bootstrap/bootstrap.py16
-rw-r--r--src/bootstrap/download.rs4
2 files changed, 9 insertions, 11 deletions
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
index 588164e4a85..9dbc87c337c 100644
--- a/src/bootstrap/bootstrap.py
+++ b/src/bootstrap/bootstrap.py
@@ -650,26 +650,24 @@ class RustBuild(object):
             if self.get_toml("patch-binaries-for-nix", "build") == "false":
                 return False
 
-            # Assume we should fix until we see evidence that it is not NixOS
-            should_fix_retval = True
-
             # Use `/etc/os-release` instead of `/etc/NIXOS`.
             # The latter one does not exist on NixOS when using tmpfs as root.
             try:
                 with open("/etc/os-release", "r") as f:
-                    should_fix_retval = any(ln.strip() in ("ID=nixos", "ID='nixos'", 'ID="nixos"') for ln in f)
+                    is_nixos = any(ln.strip() in ("ID=nixos", "ID='nixos'", 'ID="nixos"')
+                                   for ln in f)
             except FileNotFoundError:
-                should_fix_retval = False
+                is_nixos = False
 
             # If not on NixOS, then warn if user seems to be atop Nix shell
-            if not should_fix_retval:
+            if not is_nixos:
                 in_nix_shell = os.getenv('IN_NIX_SHELL')
                 if in_nix_shell:
-                    print("The IN_NIX_SHELL environment variable is set to `{}`;".format(in_nix_shell),
-                          "you may need to set `patch-binaries-for-nix=true` in your config.toml",
+                    print("The IN_NIX_SHELL environment variable is `{}`;".format(in_nix_shell),
+                          "you may need to set `patch-binaries-for-nix=true` in config.toml",
                           file=sys.stderr)
 
-            return should_fix_retval
+            return is_nixos
 
         answer = self._should_fix_bins_and_dylibs = get_answer()
         if answer:
diff --git a/src/bootstrap/download.rs b/src/bootstrap/download.rs
index bf8cb4bd768..17c308e915b 100644
--- a/src/bootstrap/download.rs
+++ b/src/bootstrap/download.rs
@@ -109,8 +109,8 @@ impl Config {
                 let in_nix_shell = env::var("IN_NIX_SHELL");
                 if let Ok(in_nix_shell) = in_nix_shell {
                     eprintln!(
-                        "The IN_NIX_SHELL environment variable is set to `{in_nix_shell}`; \
-                         you may need to set `patch-binaries-for-nix=true` in your config.toml"
+                        "The IN_NIX_SHELL environment variable is `{in_nix_shell}`; \
+                         you may need to set `patch-binaries-for-nix=true` in config.toml"
                     );
                 }
             }