Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix: windows does not have 'which' command #641

Merged
merged 1 commit into from
Apr 14, 2021

Conversation

MagicJack
Copy link
Contributor

Windows does not have 'which' command, it should be 'where' command.

@YannickJadoul
Copy link
Member

What's the context? What's the bug, or how did this bite you?

This has been working for a long while, now, I believe, so (even though I know you're right about which and where) I'm slightly confused over why it has been working (at least +1.5 years: 4096889).

@MagicJack
Copy link
Contributor Author

MagicJack commented Apr 14, 2021

This bug was found when I trying to build 'confluent-kafka-python' wheel package locally.

If I run their build batch file from windows command console, it always stop at calling command 'which python'. So, I brows their code, and found this bug form 'cibuildwheel'. Also, I found other lines of code in 'windows.py' use 'where' command instead of 'which'. So, I change it, and it did work on building 'confluent-kafka-python' wheel package.

And, of cause, if I run this build batch from window's git-bash, this bug no longer exist due to git for windows did have 'which' command in it.

@Czaki
Copy link
Contributor

Czaki commented Apr 14, 2021

This bug was found when I trying to build 'confluent-kafka-python' wheel package locally.

It is not recommended to use cibuildwheel locally on non-linux system (Linux builds use docker) as cibuildwheel install python system side.

And, of cause, if I run this build batch from window's git-bash, this bug no longer exist due to git for windows did have 'which' command in it.

It looks like all CI system which are tested has bash installed.

@joerick
Copy link
Contributor

joerick commented Apr 14, 2021

It's interesting that we've not hit this bug before, I guess that many Windows installs have which available, but perhaps some don't. I think I've come across where before, it's almost the same, but I think that it can return multiple paths rather than just a single one. But, that doesn't matter for this usage. Actually, I see where is already used around line 150, so this change seems good to me.

@YannickJadoul
Copy link
Member

YannickJadoul commented Apr 14, 2021

Actually, I see where is already used around line 150, so this change seems good to me.

Nope, I agree. Just trying to understand why we haven't run into it before and why tests pass! Maybe something to do with powershell? (Nvm, I should read messages, and not just my emails. Seems git-bash is providing it, then.)

And we're not digesting the output from which, right? I think where has a slightly different output, but this is just to log.

@YannickJadoul YannickJadoul merged commit 1344fd4 into pypa:master Apr 14, 2021
@YannickJadoul
Copy link
Member

Thanks, @MagicJack!

@henryiii
Copy link
Contributor

Most CI Windows runners are set up to be as close to Unix as possible, even when not using bash. For example, GHA/Azure added the python3 command when I asked for it, just to improve the similarity between Windows and Unix runners. But agree, this is more technically correct, and a good change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants