Source: https://www.python.org/ftp/python/3.12.5/Python-3.12.5.tgz

Config:
Check Mac/README.rst for info

env MACOSX_DEPLOYMENT_TARGET=10.14.6 ./configure --enable-framework=/Users/msp/Desktop/python-install/ --enable-universalsdk --with-universal-archs=universal2 --enable-optimizations --with-lto

env MACOSX_DEPLOYMENT_TARGET=10.14.6 make
sudo make install # sudo is needed otherwise everything won't be installed, will install in /usr/local/bin/

Copy ~/Desktop/python-install/Python.framework/ to ~/Desktop/Python.framework/ for framework we will modify
cd ~/Desktop/Python.framework/
rm -rf Resources/Python.app
rm -rf Resources/English.lproj
unlink Versions/3.12/Headers
rm -rf Versions/3.12/share
mv Versions/3.12/include Versions/3.12/Headers
~/Desktop/python-install/Python.framework/Versions/3.12/bin/python3 -m compileall ~/Python.framework/Versions/3.12/lib/python3.12 -b
rm -rf Versions/3.12/bin/
rm -rf Versions/3.12/lib/pkgconfig/
rm -rf Versions/3.12/lib/libpython3.12.dylib
find Versions/3.12/lib/python3.12  -name "*\.py" -delete
Remove all __pycache__ directories in Versions/3.12/lib/python3.12

cd Versions/3.12/lib/python3.12
rm -rf __phello__
rm antigravity.pyc
rm cgi.pyc
rm -rf config-3.12-darwin
rm -rf ctypes/test/
rm -rf curses
rm -rf distutils
rm -rf email
rm -rf ensurepip
rm -rf idlelib
rm -rf lib2to3
rm LICENSE.txt
rm -rf site-packages
rm -rf sqlite3/test
rm -rf test
rm -rf tkinter
rm turtle.pyc
rm -rf turtledemo
rm -rf unittest
rm -rf wsgiref
rm doctest.pyc
rm pydoc.pyc
rm -rf venv
rm -rf lib2to3
rm -rf idle lib

cd lib-dynload
rm _curses_panel.cpython-312-darwin.so
rm _curses.cpython-312-darwin.so

rm __hello__.pyc

cd ~/Desktop/Python.framework/
rm Headers

mv Versions/Current/lib/python3.12 Versions/Current/Resources/python3.12
rm -rf Versions/Current/lib

mv Versions/Current/lib/python3.12/lib-dynload/ Versions/Current/Frameworks
mv Versions/3.12/ Versions/A
install_name_tool -id "@rpath/Python.framework/Versions/A/Python" Versions/Current/Python

cd Versions
rm Current
ln -s A Current

cd ~/Desktop
codesign --deep -f -s "-" Python.framework

Update LICENSE url to new python release URL
Update code to look for "python3.x" for library loading
