Change:
Since , src/tools/x unconditionally looks for the shell scripts when running. That's good in most cases because it avoids having to run python. However, on old checkouts the shell scripts don't exist and it needs to fall back to using python. cc do you have time to fix this? <!-- TRIAGEBOTSTART --<!-- TRIAGEBOTASSIGNSTART --<!-- TRIAGEBOTASSIGNDATASTARTTRIAGEBOTASSIGNDATAEND --<!-- TRIAGEBOTASSIGNEND --<!-- TRIAGEBOTEND --
claim If it can wait for the weekend to pass, then yes. Anyone, feel free to claim of you can do it in the weekend
i could help! Could you give me some pointers on what needs to be done?
What you should do is re-add the code that was removed in , using it when the shell scripts are not found, but x.py is. You could even add an env var that forces the use of python, but that's a later step.
I see! Okay I'll give this a shot! But I may need more time than just the weekends cause I probably need some time to figure things out. But if it's urgent then feel free to unassign me claim
I don't think this is necessary, there shouldn't be any functionality that's available in python but not shell.
It is future-proofing for when python does get used only when building bootstrap, and the shell scripts won't be able to call python
That can be done with a function argument so it's not exposed to users.
Yes, it can work like this.
Hi ! Currently working on this. Could you list out the steps needed to replicate this issue so I could get a bit more context of the problem? Thank you!
install it from a current version of the repository, then check out any commit from before and run . It will says "x.py not found" even though it exists in the repository.
Err sorry, that was the commit that changes src/tools/x - you want the commit that initially the ./x and x.ps1 scripts.
One reason may be because they work on a pr that started before this commit, and that (miraculously) didn't conflict. Another reason would have been because the work was done on stable/beta, but I think the scripts are now on stable (correct me if I'm wrong)

Discussion:
[package] name = "x" <del> version = "0.1.0" </del> <ins> version = "0.1.1" </ins> description = "Run x.py slightly more conveniently" edition = "2021" publish = false

//! We also don't use `pwsh` on Windows, because it is not installed by default; use std::{ <del> env, io, </del> <ins> env::{self, consts::EXE_EXTENSION}, io, </ins> path::Path, process::{self, Command, ExitStatus}, }; <ins> const PYTHON: &str = "python"; const PYTHON2: &str = "python2"; const PYTHON3: &str = "python3"; fn python() -> &'static str { let val = match env::var_os("PATH") { Some(val) => val, None => return PYTHON, }; let mut python2 = false; let mut python3 = false; for dir in env::split_paths(&val) { // `python` should always take precedence over python2 / python3 if it exists if dir.join(PYTHON).with_extension(EXE_EXTENSION).exists() { return PYTHON; } python2 |= dir.join(PYTHON2).with_extension(EXE_EXTENSION).exists(); python3 |= dir.join(PYTHON3).with_extension(EXE_EXTENSION).exists(); } // try 3 before 2 if python3 { PYTHON3 } else if python2 { PYTHON2 } else { // Python was not found on path, so exit eprintln!("Unable to find python in your PATH. Please check it is installed."); process::exit(1); } } </ins> #[cfg(windows)] fn x_command(dir: &Path) -> Command { let mut cmd = Command::new("powershell.exe");

command.status() } <ins> fn handle_result(result: io::Result<ExitStatus>, cmd: Command) { match result { Err(error) => { eprintln!("Failed to invoke `{:?}`: {}", cmd, error); } Ok(status) => { process::exit(status.code().unwrap_or(1)); } } } </ins> fn main() { match env::args().skip(1).next().as_deref() { Some("--wrapper-version") => {

for dir in current.ancestors() { let candidate = dir.join("x.py"); if candidate.exists() { <del> let mut cmd = x_command(dir); cmd.args(env::args().skip(1)).current_dir(dir); let result = exec_or_status(&mut cmd); match result { Err(error) => { eprintln!("Failed to invoke `{:?}`: {}", cmd, error); } Ok(status) => { process::exit(status.code().unwrap_or(1)); } </del> <ins> let shell_script_candidate = dir.join("x"); let mut cmd: Command; if shell_script_candidate.exists() { cmd = x_command(dir); cmd.args(env::args().skip(1)).current_dir(dir); } else { // For older checkouts that do not have the x shell script, default to python cmd = Command::new(python()); cmd.arg(&candidate).args(env::args().skip(1)).current_dir(dir); </ins> } <ins> let result = exec_or_status(&mut cmd); handle_result(result, cmd); </ins> } }