You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
HOMEBREW_VERSION: 4.3.19
ORIGIN: https://github.com/Homebrew/brew
HEAD: 1f9bd2de89883ec9a59db3eab0f5475bce06d5bc
Last commit: 11 days ago
Core tap JSON: 05 Sep 20:16 UTC
Core cask tap JSON: 05 Sep 20:16 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 12
Homebrew Ruby: 3.3.4 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/bin/ruby
CPU: dodeca-core 64-bit arm_blizzard_avalanche
Clang: 15.0.0 build 1500
Git: 2.46.0 => /opt/homebrew/bin/git
Curl: 8.7.1 => /usr/bin/curl
macOS: 14.6.1-arm64
CLT: 15.3.0.0.1.1708646388
Xcode: 15.4
Rosetta 2: false
### Output of `brew doctor`
```shell
mahyar@lioness vivaldi % brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!
Warning: Some installed formulae are deprecated or disabled.
You should find replacements for the following formulae:
neofetch
python@3.8
Warning: You have the following deprecated, official taps tapped:
Homebrew/homebrew-cask-versions
Untap them with `brew untap`.
### Description of issue
I want to make a `deadsnakes` Tap for deprecated versions of Python. I borrowed the name from the `deadsnakes` PPA that keeps older Python versions available. I am trying to decipher and figure out how the Python formulae were created in the Homebrew core. Is there someone who can point me in the right direction to get working on this?
After reading a bit through the Ruby code (I don't know how to program in Ruby), the Python versions in Homebrew seem to be built from the source. It seems that they are then compiled with things like this:
```rb
# The --enable-optimization and --with-lto flags diverge from what upstream
# python does for their macOS binary releases. They have chosen not to apply
# these flags because they want one build that will work across many macOS
# releases. Homebrew is not so constrained because the bottling
# infrastructure specializes for each macOS major release.
args = %W[
--prefix=#{prefix}
--enable-ipv6
--datarootdir=#{share}
--datadir=#{share}
--without-ensurepip
--enable-loadable-sqlite-extensions
--with-openssl=#{Formula["openssl@3"].opt_prefix}
--with-dbmliborder=gdbm:ndbm
--enable-optimizations
--with-lto
--with-system-expat
--with-system-libmpdec
]
Then, there are things like this which I assume comes from them looking in the setup.py offered by the Gzip of the Python version tarball and then editing it as needed?
# Disable _tkinter - this is built in a separate formula python-tkinreplace"setup.py","DISABLED_MODULE_LIST = []","DISABLED_MODULE_LIST = ['_tkinter']"
Then, there are stuff like this:
defsitecustomize<<~EOS # This file is created by Homebrew and is executed on each python startup. # Don't print from here, or else python command line scripts may fail! # <https://docs.brew.sh/Homebrew-and-Python> import re import os import site import sys if sys.version_info[:2] != (#{version.major}, #{version.minor}): # This can only happen if the user has set the PYTHONPATH to a mismatching site-packages directory. # Every Python looks at the PYTHONPATH variable and we can't fix it here in sitecustomize.py, # because the PYTHONPATH is evaluated after the sitecustomize.py. Many modules (e.g. PyQt4) are # built only for a specific version of Python and will fail with cryptic error messages. # In the end this means: Don't set the PYTHONPATH permanently if you use different Python versions. exit(f'Your PYTHONPATH points to a site-packages dir for Python #{version.major_minor} ' f'but you are running Python {sys.version_info[0]}.{sys.version_info[1]}!\\n' f' PYTHONPATH is currently: "{os.environ["PYTHONPATH"]}"\\n' f' You should `unset PYTHONPATH` to fix this.') # Only do this for a brewed python: if os.path.realpath(sys.executable).startswith('#{rack}'): # Shuffle /Library site-packages to the end of sys.path library_site = '/Library/Python/#{version.major_minor}/site-packages' library_packages = [p for p in sys.path if p.startswith(library_site)] sys.path = [p for p in sys.path if not p.startswith(library_site)] # .pth files have already been processed so don't use addsitedir sys.path.extend(library_packages) # the Cellar site-packages is a symlink to the HOMEBREW_PREFIX # site_packages; prefer the shorter paths long_prefix = re.compile(r'#{rack}/[0-9\\._abrc]+/Frameworks/Python\\.framework/Versions/#{version.major_minor}/lib/python#{version.major_minor}/site-packages') sys.path = [long_prefix.sub('#{site_packages}', p) for p in sys.path] # Set the sys.executable to use the opt_prefix. Only do this if PYTHONEXECUTABLE is not # explicitly set and we are not in a virtualenv: if 'PYTHONEXECUTABLE' not in os.environ and sys.prefix == sys.base_prefix: sys.executable = sys._base_executable = '#{opt_bin}/python#{version.major_minor}' if 'PYTHONHOME' not in os.environ: cellar_prefix = re.compile(r'#{rack}/[0-9\\._abrc]+/') if os.path.realpath(sys.base_prefix).startswith('#{rack}'): new_prefix = cellar_prefix.sub('#{opt_prefix}/', sys.base_prefix) if sys.prefix == sys.base_prefix: site.PREFIXES[:] = [new_prefix if x == sys.prefix else x for x in site.PREFIXES] sys.prefix = new_prefix sys.base_prefix = new_prefix if os.path.realpath(sys.base_exec_prefix).startswith('#{rack}'): new_exec_prefix = cellar_prefix.sub('#{opt_prefix}/', sys.base_exec_prefix) if sys.exec_prefix == sys.base_exec_prefix: site.PREFIXES[:] = [new_exec_prefix if x == sys.exec_prefix else x for x in site.PREFIXES] sys.exec_prefix = new_exec_prefix sys.base_exec_prefix = new_exec_prefix # Check for and add the python-tk prefix. tkinter_prefix = "#{HOMEBREW_PREFIX}/opt/python-tk@#{version.major_minor}/libexec" if os.path.isdir(tkinter_prefix): sys.path.append(tkinter_prefix) EOSend
What does it mean that it is created by Homebrew? Is there like a tool? More details on this would be helpful. I plan to start with supporting my own MacOS version, and then supporting others as needed.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Output of
brew config
Then, there are things like this which I assume comes from them looking in the
setup.py
offered by the Gzip of the Python version tarball and then editing it as needed?Then, there are stuff like this:
What does it mean that it is created by Homebrew? Is there like a tool? More details on this would be helpful. I plan to start with supporting my own MacOS version, and then supporting others as needed.
Beta Was this translation helpful? Give feedback.
All reactions