This commit allows building Python with the following libraries
installed via MacPorts:
- ncurses
- openssl
- readline
- zlib (XCode SDK zlib is still tried first)
If either Homebrew or MacPorts system is the only one installed, that system
will be used automatically.
When both systems are installed, then whatever is found first in PATH - brew
or port - will be used for all dependencies.
The following environment variables can be set to non-empty value to override
the selection:
PYTHON_BUILD_USE_HOMEBREW
PYTHON_BUILD_USE_MACPORTS
Tcl/Tk specific support is omitted due to CPython incompatibility with
Tcl/Tk 9, according to the comments in use_homebrew_tcltk().
Those who need Tcl/Tk module, can use PYTHON_CONFIGURE_OPTS --with-tcltk-libs=
pointing to the Tcl/Tk location which can be installed either from sources or
via MacPorts.
Tests for added *_macports_* functions are based off of the corresponding
brew counterparts.
Add MacPorts support for python-build
This commit allows building Python with the following libraries
installed via MacPorts:
- ncurses
- openssl
- readline
- zlib (XCode SDK zlib is still tried first)
If either Homebrew or MacPorts system is the only one installed, that system
will be used automatically.
When both systems are installed, then whatever is found first in PATH - brew
or port - will be used for all dependencies.
The following environment variables can be set to non-empty value to override
the selection:
PYTHON_BUILD_USE_HOMEBREW
PYTHON_BUILD_USE_MACPORTS
Tcl/Tk specific support is omitted due to CPython incompatibility with
Tcl/Tk 9, according to the comments in use_homebrew_tcltk().
Those who need Tcl/Tk module, can use PYTHON_CONFIGURE_OPTS --with-tcltk-libs=
pointing to the Tcl/Tk location which can be installed either from sources or
via MacPorts.
Tests for added *_macports_* functions are based off of the corresponding
brew counterparts.
1) Got rid of useless call to `cat`, much better to simply use sed with
file as argument.
2) Got rid of `sort -u`. There is no need to sort the list.
Additionally, the list `pyenv.d/rehash/conda.d/default.list` only has
unique entries, and even if you have duplicate entries, the function
will still work. --> No need for sort nor unique.
3) Further improvement is simple, save a cached
cleaned-list-v1.0 in `conda.d` and simple read from that file instead of
doing `sed`, which must be a more expensive operation than simply
reading from file.
Applies to the conda blacklist in `pyenv.d/rehash/conda.d/default.list`
No practical difference, but it looks misplaced when it sits at the end
of the file.
I was doing some debugging with PYENV_DEBUG=1 and noticed that a lot of
work was being done in conda.bash, even though I had not installed any
conda versions like `mambaforge`.
The solution is pretty simple, put all the code inside an if-block.
This aligns with what @varikin found in his pull request #3037
Additionally, I have refactored the code slightly for readability
(created function `build_conda_exclusion_list`), and added comments
which should make it easier to understand what's going on.
This commit simplifies debugging and should reduce the execution time of
```bash
eval "$(pyenv init -)"
```
slightly.
Now that ubuntu-24 is out of beta at Github
Since for ubuntu_build, we only use one OS version
and the changes between versions are not as drastic as with MacOS,
it seems safe to have it upgrade automatically.