atsalolikhin-spokeo commented on issue #10389:
URL: https://github.com/apache/airflow/issues/10389#issuecomment-679288678
```
[~/git/airflow] fix/10389 ±
[~/git/airflow] fix/10389 ± command -v getopt
/usr/bin/getopt
[~/git/airflow] fix/10389 ± getopt --version
--
[~/git/airflow] fix/10389 ± getopt -T
--
[~/git/airflow] fix/10389 ± echo $?
0
[~/git/airflow] fix/10389 ± brew --prefix getopt
Error: No available formula with the name "getopt"
[~/git/airflow] fix/10389 ± hash -r
[~/git/airflow] fix/10389 ± command -v getopt
/usr/bin/getopt
[~/git/airflow] fix/10389 ±
```
I opened a new shell:
```
[~] $ command -v getopt
/usr/bin/getopt
[~] $
```
Okay, that's the macOS getopt; so where is brew's getopt?
```
[~] $ find . -name getopt 2>/dev/null
./git/homebrew/Cellar/gnu-getopt/2.36/bin/getopt
./git/homebrew/Cellar/gnu-getopt/2.36/etc/bash_completion.d/getopt
./git/homebrew/Cellar/libusb/1.0.23/share/libusb/examples/getopt
[~] $ ./git/homebrew/Cellar/gnu-getopt/2.36/bin/getopt --version
getopt from util-linux 2.36
[~] $
```
So I've added it to my PATH.
```
[~/git/airflow] fix/10389 ± type getopt
getopt is /Users/atsalolikhin/git/homebrew/Cellar/gnu-getopt/2.36/bin/getopt
[~/git/airflow] fix/10389 ±
```
Now the pre-commit hook works:
```
[~/git/airflow] fix/10389 ± pre-commit run build --verbose
Check if image build is needed...........................................
Please confirm rebuild image CI-python3.6. Are you sure? [y/N/q]
y
The answer is 'yes'. rebuild image CI-python3.6. This can take some time!
Preparing apache/airflow:master-python3.6-ci.
Docker pulling python:3.6-slim-buster.
Build log:
/var/folders/5m/1v1dg76s7zbdpwj39dh5skv80000gp/T/tmp.BExKt31d/out.log
/
Preparing apache/airflow:master-python3.6-ci.
Docker building apache/airflow:master-python3.6-ci.
Build log:
/var/folders/5m/1v1dg76s7zbdpwj39dh5skv80000gp/T/tmp.BExKt31d/out.log
Step 96/100 :\
Passed
- hook id: build
- duration: 66.95s
Some of your images need to be rebuild because important files (like package
list) has changed.
You have those options:
* Rebuild the images now by answering 'y' (this might take some time!)
* Skip rebuilding the images and hope changes are not big (you will be
asked again)
* Quit and manually rebuild the images using one of the following commands
* ./breeze build-image
* ./breeze build-image --force-pull-images
The first command works incrementally from your last local build.
The second command you use if you want to completely refresh your images
from dockerhub.
Force pull base image python:3.6-slim-buster
Pulling the image apache/airflow:master-python3.6-ci
[~/git/airflow] fix/10389 ±
```
It's too bad the brew install didn't automagically make the gnu-getopt take
precedence over the system getopt. I understand the need for user
awareness/choice in that. I must have not read the prompt to take the manual
step to adjust the path. Anyway it's done now. Thanks!
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]