This method predates Python's standardized `pyproject.toml` build system,
introduced in PEP 517 to allow for more build backends than just
`setuptools`: https://peps.python.org/pep-0517/. Directly executing
`setup.py` has since been deprecated in favor of using PEP 517 compliant
installers, such as `pip`: https://packaging.python.org/en/latest/discussions/setup-py-deprecated/
In homebrew/core, our last remaining use is a single disabled formula.
For third party taps, simply migrate to `std_pip_args`:
```ruby
# Old
system python3, *Language::Python.setup_install_args(libexec, python3)
# New
system python3, "-m", "pip", "install", *std_pip_args, "."
```
We should use `\A` to pick up shebangs at the start of files instead of
just anywhere in a given script.
See Homebrew/homebrew-core#227654 for an example where this can cause
problems.
Add `without`, `start_with`, and `end_with` to allow basic control over
the order that resources are installed so that the situations where we
have to split up `virtualenv_install_with_resources` is reduced.
Co-authored-by: Kevin <apainintheneck@gmail.com>
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
Signed-off-by: Michael Cho <michael@michaelcho.dev>
This reworks `Language::Python::Shebang` to use constants for
the shebang regex and max length (like the previous Node commit).
Besides that, this also adds type signatures to the existing methods.
Some formulae are flexible about the version of Python3 that they use.
However, when we use `#detected_python_shebang` on these formulae, they
become coupled to the specific version of Python3 declared in the
formula.
This is harmful because
1. it prevents us from using `uses_from_macos "python"` even in formulae
where we should be able to
2. it forces us to rebuild the formula whenever we make changes to the
Python dependency when nothing but the shebang would have changed as
a consequence of the rebuild
For an example of this, see Homebrew/homebrew-core#107905.
I'd also like to do this to get rid of some really terrible hacks we
have in `glib-utils` as a means of decoupling `glib` from the specific
versioned Python dependency it used to have.
See Homebrew/homebrew-core#103916, or Homebrew/homebrew-core#106045 for
a proposal to give the same treatment to `gobject-introspection`.