docs: remove :python requirement
This commit is contained in:
parent
02591bdf34
commit
762f2fd2d8
@ -69,7 +69,7 @@ Homebrew builds bindings against the first `python` (and `python-config`) in you
|
||||
**Warning!** Python may crash (see [Common Issues](Common-Issues.md)) if you `import <module>` from a brewed Python if you ran `brew install <formula_with_python_bindings>` against the system Python. If you decide to switch to the brewed Python, then reinstall all formulae with Python bindings (e.g. `pyside`, `wxwidgets`, `pygtk`, `pygobject`, `opencv`, `vtk` and `boost-python`).
|
||||
|
||||
## Policy for non-brewed Python bindings
|
||||
These should be installed via `pip install <package>`. To discover, you can use `pip search` or <https://pypi.python.org/pypi>. (**Note:** System Python does not provide `pip`. Follow the instructions at <https://pip.readthedocs.io/en/stable/installing/#install-pip> to install it for your system Python if you would like it.)
|
||||
These should be installed via `pip install <package>`. To discover, you can use `pip search` or <https://pypi.python.org/pypi>. (**Note:** System Python does not provide `pip`. Follow the [pip documentation](https://pip.readthedocs.io/en/stable/installing/#install-pip) to install it for your system Python if you would like it.)
|
||||
|
||||
## Brewed Python modules
|
||||
For brewed Python, modules installed with `pip` or `python setup.py install` will be installed to the `$(brew --prefix)/lib/pythonX.Y/site-packages` directory (explained above). Executable Python scripts will be in `$(brew --prefix)/bin`.
|
||||
@ -89,4 +89,4 @@ Homebrew will still install Python modules into Homebrew's `site-packages` and *
|
||||
Virtualenv has a `--system-site-packages` switch to allow "global" (i.e. Homebrew's) `site-packages` to be accessible from within the virtualenv.
|
||||
|
||||
## Why is Homebrew's Python being installed as a dependency?
|
||||
Formulae that depend on the special `:python` target are bottled against the Homebrew Python and require it to be installed. You can avoid installing Homebrew's Python by building these formulae with `--build-from-source`.
|
||||
Formulae that declare an unconditional dependency on the `"python"` or `"python3"` formulae are bottled against Homebrew's Python 2.7.x or 3.x and require it to be installed. You can avoid installing Homebrew's Python by running `brew install --build-from-source <formula>`.
|
||||
|
||||
@ -34,10 +34,10 @@ If your formula requires being executed with an older Node version you should us
|
||||
|
||||
### Special requirements for native addons
|
||||
|
||||
If your Node module is a native addon or has a native addon somewhere in its dependency tree you have to declare an additional dependency. Since the compilation of the native addon results in an invocation of `node-gyp` we need an additional build time dependency on `:python` (because gyp depends on Python 2.7).
|
||||
If your Node module is a native addon or has a native addon somewhere in its dependency tree you have to declare an additional dependency. Since the compilation of the native addon results in an invocation of `node-gyp` we need an additional build time dependency on `"python"` (because GYP depends on Python 2.7).
|
||||
|
||||
```ruby
|
||||
depends_on :python => :build
|
||||
depends_on "python" => :build
|
||||
```
|
||||
|
||||
Also note that such a formula would only be compatible with the same Node major version it originally was compiled with. This means that we need to revision every formula with a Node native addon with every major version bump of the `node` formula. To make sure we don't overlook your formula on a Node major version bump, write a meaningful test which would fail in such a case (invoked with an ABI-incompatible Node version).
|
||||
@ -99,7 +99,7 @@ class Foo < Formula
|
||||
|
||||
depends_on "node"
|
||||
# uncomment if there is a native addon inside the dependency tree
|
||||
# depends_on :python => :build
|
||||
# depends_on "python" => :build
|
||||
|
||||
def install
|
||||
system "npm", "install", *Language::Node.std_npm_install_args(libexec)
|
||||
|
||||
@ -19,12 +19,12 @@ Applications should unconditionally bundle all of their Python-language dependen
|
||||
Applications that are compatible with Python 2 **should** use the Apple-provided system Python in `/usr/bin` on systems that provide Python 2.7. To do this, declare:
|
||||
|
||||
```ruby
|
||||
depends_on :python if MacOS.version <= :snow_leopard
|
||||
depends_on "python" if MacOS.version <= :snow_leopard
|
||||
```
|
||||
|
||||
No explicit Python dependency is needed on recent OS versions since `/usr/bin` is always in `PATH` for Homebrew formulae; on Leopard and older, the python in `PATH` is used if it's at least version 2.7, or else Homebrew's python is installed.
|
||||
No explicit Python dependency is needed on recent OS versions since `/usr/bin` is always in `PATH` for Homebrew formulae; on Leopard and older, the `python` in `PATH` is used if it's at least version 2.7, or else Homebrew's Python 2.7.x is installed.
|
||||
|
||||
Formulae for apps that require Python 3 **should** declare an unconditional dependency on `:python3`, which will cause the formula to use the first python3 discovered in `PATH` at install time (or install Homebrew's if there isn't one). These apps **must** work with the current Homebrew python3 formula.
|
||||
Formulae for apps that require Python 3 **should** declare an unconditional dependency on `"python3"`, which will cause the formula to use the first `python3` discovered in `PATH` at install time (or install Homebrew's if there isn't one). These apps **must** work with the current Homebrew Python 3.x formula.
|
||||
|
||||
### Installing
|
||||
|
||||
@ -66,7 +66,7 @@ This is exactly the same as writing:
|
||||
```ruby
|
||||
def install
|
||||
# Create a virtualenv in `libexec`. If your app needs Python 3, make sure that
|
||||
# `depends_on :python3` is declared, and use `virtualenv_create(libexec, "python3")`.
|
||||
# `depends_on "python3"` is declared, and use `virtualenv_create(libexec, "python3")`.
|
||||
venv = virtualenv_create(libexec)
|
||||
# Install all of the resources declared on the formula into the virtualenv.
|
||||
venv.pip_install resources
|
||||
@ -121,9 +121,9 @@ in case you need to do different things for different resources.
|
||||
|
||||
## Bindings
|
||||
|
||||
Build bindings with system Python by default (don't add an option) and they should be usable with any binary-compatible Python. If that isn't the case, it's an upstream bug; [here's some advice for resolving it](http://blog.tim-smith.us/2015/09/python-extension-modules-os-x/).
|
||||
Build bindings with the system Python by default (don't add an option) and they should be usable with any binary-compatible Python. If that isn't the case, it's an upstream bug; [here's some advice for resolving it](http://blog.tim-smith.us/2015/09/python-extension-modules-os-x/).
|
||||
|
||||
To add bindings for Python 3, please add `depends_on :python3 => :optional` and make the bindings conditional on `build.with?("python3")`.
|
||||
To add bindings for Python 3, please add `depends_on "python3" => :optional` and make the bindings conditional on `build.with?("python3")`.
|
||||
|
||||
### Dependencies
|
||||
|
||||
@ -153,7 +153,7 @@ Sometimes we have to `inreplace` a `Makefile` to use our prefix for the Python b
|
||||
|
||||
### Python declarations
|
||||
|
||||
Python 2 libraries do not need a `depends_on :python` declaration; they will be built with system Python, but should still be usable with any other Python 2.7. If this is not the case, it is an upstream bug; [here is some advice for resolving it](http://blog.tim-smith.us/2015/09/python-extension-modules-os-x/). Libraries built for Python 3 should include `depends_on :python3`, which will bottle against Homebrew's python3, and use the first python3 discovered in `PATH` at build time when installing from source with `brew install --build-from-source`. If a library supports both Python 2.x and Python 3.x, the `:python3` dependency should be `:optional`. Python 2.x libraries must function when they are installed against either the system Python or Homebrew Python.
|
||||
Python 2 libraries do not need a `depends_on "python"` declaration; they will be built with the system Python, but should still be usable with any other Python 2.7. If this is not the case, it is an upstream bug; [here is some advice for resolving it](http://blog.tim-smith.us/2015/09/python-extension-modules-os-x/). Libraries built for Python 3 should include `depends_on "python3"`, which will bottle against Homebrew's Python 3.x, and use the first `python3` discovered in `PATH` at build time when installing from source with `brew install --build-from-source`. If a library supports both Python 2.x and Python 3.x, the `"python3"` dependency should be `:optional`. Python 2.x libraries must function when they are installed against either the system Python or brewed Python.
|
||||
|
||||
### Installing
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user