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

macos-build-python fails with Error in brew list #1

Closed
jaraco opened this issue Jan 10, 2021 · 0 comments
Closed

macos-build-python fails with Error in brew list #1

jaraco opened this issue Jan 10, 2021 · 0 comments

Comments

@jaraco
Copy link
Owner

jaraco commented Jan 10, 2021

Attempting to run python -m jaraco.develop.macos-build-python, the routine fails with this output:

cpython master $ pip-run -q jaraco.develop -- -m jaraco.develop.macos-build-python
Error: Calling `brew list` to only list formulae is disabled! Use `brew list --formula` instead.
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-run-c829elas/jaraco/develop/macos-build-python.py", line 32, in <module>
    def build_on_macOS():
  File "/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-run-c829elas/autocommand/autocommand.py", line 66, in autocommand_decorator
    func = automain(module)(func)
  File "/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-run-c829elas/autocommand/automain.py", line 55, in automain_decorator
    sys.exit(main(*args, **kwargs))
  File "/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-run-c829elas/autocommand/autoparse.py", line 301, in autoparse_wrapper
    return func(*parsed_args.args, **parsed_args.kwargs)
  File "/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-run-c829elas/jaraco/develop/macos-build-python.py", line 37, in build_on_macOS
    require_libs()
  File "/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-run-c829elas/jaraco/develop/macos-build-python.py", line 25, in require_libs
    installed = subprocess.check_output(cmd, text=True).strip().split()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 420, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 524, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['brew', 'list']' returned non-zero exit status 1.

The error can be replicated in isolation with:

$ python
Python 3.9.0 (v3.9.0:9cf6752276, Oct  5 2020, 11:29:23) 
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> subprocess.check_output(['brew', 'list'])
Error: Calling `brew list` to only list formulae is disabled! Use `brew list --formula` instead.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 420, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 524, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['brew', 'list']' returned non-zero exit status 1.

Note, using Popen (not capturing the output) works as expected.

The problem boils down to an intentional breaking of brew list for non-interactive use and the recommended fix is to pass --formula.

@jaraco jaraco closed this as completed in 53900b2 Jan 10, 2021
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

No branches or pull requests

1 participant