Fix MacPorts OpenSSL formula detection#3416
Closed
tekintian wants to merge 1 commit intopyenv:masterfrom
Closed
Conversation
- Modify prefer_openssl3 to detect MacPorts environment and use appropriate package names - Update use_macports_openssl to use PYTHON_BUILD_MACPORTS_OPENSSL_FORMULA instead of PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA - Prevents 'Error: No available formula with the name [email protected]' when using MacPorts"
native-api
requested changes
Mar 7, 2026
| # Allow overriding the preference of OpenSSL version per definition basis (#1302, #1325, #1326) | ||
| PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA="${PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA:-openssl@3 [email protected] openssl}" | ||
| export PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA | ||
| if can_use_macports; then |
Member
There was a problem hiding this comment.
No need to check for MacPorts presence here. Just set both envvars. The functions that actually use them check for presence.
| export PYTHON_BUILD_HOMEBREW_OPENSSL_FORMULA | ||
| if can_use_macports; then | ||
| # MacPorts uses a different package naming convention and does not use the @ symbol. | ||
| PYTHON_BUILD_MACPORTS_OPENSSL_FORMULA="${PYTHON_BUILD_MACPORTS_OPENSSL_FORMULA:-openssl3 openssl}" |
Member
There was a problem hiding this comment.
Need to document the new envvar in the README
Contributor
Author
|
Thanks for the feedback! I've updated the PR to:
The changes are now pushed to the same branch. Please let me know if any further adjustments are needed. |
Member
...or are they?.. I don't see any changes. |
5 tasks
Contributor
Author
here #3417 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Make sure you have checked all steps below.
Prerequisite
https://github.com/rbenv/rbenvDescription
Here are some details about my PR
Fixed the issue where pyenv tries to find non-existent Homebrew package names (like [email protected]) in MacPorts environment, causing installation failures.
prefer_openssl3to set both HOMEBREW and MACPORTS OpenSSL formula variablesprefer_openssl3PYTHON_BUILD_MACPORTS_OPENSSL_FORMULAenvironment variable in READMETests
My PR adds the following unit tests (if any)
Tested Python 3.11.15 installation in MacPorts environment, confirming that the "Error: No available formula" error no longer occurs.
Test environment:
Additional Context
This issue affects users who use MacPorts instead of Homebrew as their package manager on macOS. The root cause is that MacPorts uses different package naming conventions (without the @ symbol) compared to Homebrew. When pyenv tries to find Homebrew-style package names in MacPorts, it fails with the error "Error: No available formula with the name '[email protected]'".
This fix makes pyenv more package manager-agnostic by detecting the environment and using appropriate package names.