Skip to content

Fix MacPorts OpenSSL formula detection#3417

Merged
native-api merged 4 commits intopyenv:masterfrom
tekintian:fix-macports-openssl-only
Mar 7, 2026
Merged

Fix MacPorts OpenSSL formula detection#3417
native-api merged 4 commits intopyenv:masterfrom
tekintian:fix-macports-openssl-only

Conversation

@tekintian
Copy link
Copy Markdown
Contributor

  • 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"

Make sure you have checked all steps below.

Prerequisite

  • Please consider implementing the feature as a hook script or plugin as a first step.
    • I considered implementing this as a plugin, but this issue affects core functionality and is better fixed in the core code.
  • Please consider contributing the patch upstream to https://github.com/rbenv/rbenv
    • I checked rbenv, and it doesn't have MacPorts-related code. This is a pyenv-specific issue.
  • My PR addresses the following pyenv issue (if any)
    Fix MacPorts OpenSSL formula detection #3416

Description

  • 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.

    1. Modified prefer_openssl3 to set both HOMEBREW and MACPORTS OpenSSL formula variables
    2. Let individual functions check for package manager presence rather than checking in prefer_openssl3
    3. Added documentation for new PYTHON_BUILD_MACPORTS_OPENSSL_FORMULA environment variable in README

Tests

  • 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:

    • macOS with MacPorts installed
    • pyenv with python-build plugin
    • Multiple Python versions tested (3.9, 3.10, 3.11)

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.

- 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"
- Set both HOMEBREW and MACPORTS OpenSSL formula variables in prefer_openssl3
- Let individual functions check for package manager presence
- Document PYTHON_BUILD_MACPORTS_OPENSSL_FORMULA in python-build README
@tekintian tekintian requested review from a team as code owners March 7, 2026 05:37
@tekintian tekintian changed the title Fix macports openssl only Fix MacPorts OpenSSL formula detection Mar 7, 2026
Comment thread plugins/python-build/bin/python-build Outdated
Comment thread plugins/python-build/bin/python-build Outdated
Comment thread plugins/python-build/README.md Outdated
@native-api
Copy link
Copy Markdown
Member

Push the changes to the PR branch (the "from " under the PR title) for them to be reflected here.

tekintian and others added 2 commits March 7, 2026 15:52
- Set both HOMEBREW and MACPORTS OpenSSL formula variables in prefer_openssl3
- Let individual functions check for package manager presence
- Document PYTHON_BUILD_MACPORTS_OPENSSL_FORMULA in python-build README
@native-api native-api merged commit d5fa1e2 into pyenv:master Mar 7, 2026
20 checks passed
@native-api
Copy link
Copy Markdown
Member

native-api commented Mar 7, 2026

Thank you for your contribution!

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

Successfully merging this pull request may close these issues.

2 participants