Import Upstream version 2.7.18

This commit is contained in:
geos_one
2025-08-15 16:28:06 +02:00
commit ba1f69ab39
4521 changed files with 1778434 additions and 0 deletions

66
Mac/IDLE/Info.plist.in Normal file
View File

@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>py</string>
<string>pyw</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>PythonSource.icns</string>
<key>CFBundleTypeName</key>
<string>Python Script</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>pyc</string>
<string>pyo</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>PythonCompiled.icns</string>
<key>CFBundleTypeName</key>
<string>Python Bytecode Document</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
</dict>
</array>
<key>CFBundleExecutable</key>
<string>IDLE</string>
<key>CFBundleGetInfoString</key>
<string>%VERSION%, © 2001-2019 Python Software Foundation</string>
<key>CFBundleIconFile</key>
<string>IDLE.icns</string>
<key>CFBundleIdentifier</key>
<string>org.python.IDLE</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>IDLE</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>%VERSION%</string>
<key>CFBundleVersion</key>
<string>%VERSION%</string>
<key>NSHighResolutionCapable</key>
<true/>
<!--
<key>LSMinimumSystemVersionByArchitecture</key>
<dict>
<key>x86_64</key>
<string>10.6.0</string>
<key>ppc64</key>
<string>10.6.0</string>
</dict>
-->
</dict>
</plist>

76
Mac/IDLE/Makefile.in Normal file
View File

@@ -0,0 +1,76 @@
prefix=@prefix@
CC=@CC@
LD=@CC@
BASECFLAGS=@BASECFLAGS@
OPT=@OPT@
CFLAGS=$(BASECFLAGS) $(OPT)
LDFLAGS=@LDFLAGS@
srcdir= @srcdir@
VERSION= @VERSION@
LIBDEST=$(prefix)/lib/python$(VERSION)
UNIVERSALSDK=@UNIVERSALSDK@
builddir= ../..
PYTHONFRAMEWORK=@PYTHONFRAMEWORK@
RUNSHARED= @RUNSHARED@
BUILDEXE= @BUILDEXEEXT@
BUILDPYTHON= $(builddir)/python$(BUILDEXE)
# Deployment target selected during configure, to be checked
# by distutils
MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
@EXPORT_MACOSX_DEPLOYMENT_TARGET@export MACOSX_DEPLOYMENT_TARGET
BUNDLEBULDER=$(srcdir)/../../Lib/plat-mac/bundlebuilder.py
PYTHONAPPSDIR=@FRAMEWORKINSTALLAPPSPREFIX@/$(PYTHONFRAMEWORK) $(VERSION)
all: IDLE.app
install: IDLE.app
test -d "$(DESTDIR)$(PYTHONAPPSDIR)" || mkdir -p "$(DESTDIR)$(PYTHONAPPSDIR)"
-test -d "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app" && rm -r "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app"
/bin/cp -PR IDLE.app "$(DESTDIR)$(PYTHONAPPSDIR)"
touch "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app"
if [ -f "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def" ]; then \
/bin/cp -p "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def" \
"$(DESTDIR)$(LIBDEST)/idlelib/config-main.def~" ; \
sed -e 's!name= IDLE Classic Windows!name= IDLE Classic OSX!g' \
< "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def~" \
> "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def" ; \
rm "$(DESTDIR)$(LIBDEST)/idlelib/config-main.def~" ; \
fi
if [ -f "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def" ]; then \
/bin/cp -p "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def" \
"$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def~" ; \
sed -e 's!zoom-height=<Alt-Key-2>!zoom-height=<Option-Key-0>!g' \
-e 's!<Alt-Key-!<Option-Key-!g' \
< "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def~" \
> "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def" ; \
rm "$(DESTDIR)$(LIBDEST)/idlelib/config-extensions.def~" ; \
fi
clean:
rm -rf IDLE.app
IDLE.app: \
$(srcdir)/../Icons/IDLE.icns $(srcdir)/idlemain.py \
$(srcdir)/../Icons/PythonSource.icns \
$(srcdir)/../Icons/PythonCompiled.icns Info.plist
rm -fr IDLE.app
$(RUNSHARED) @ARCH_RUN_32BIT@ $(BUILDPYTHON) $(BUNDLEBULDER) \
--builddir=. \
--name=IDLE \
--link-exec \
--plist=Info.plist \
--mainprogram=$(srcdir)/idlemain.py \
--iconfile=$(srcdir)/../Icons/IDLE.icns \
--resource=$(srcdir)/../Icons/PythonSource.icns \
--resource=$(srcdir)/../Icons/PythonCompiled.icns \
--python=$(prefix)/Resources/Python.app/Contents/MacOS/Python \
build
Info.plist: $(srcdir)/Info.plist.in
sed 's/%VERSION%/'"`$(RUNSHARED) $(BUILDPYTHON) -c 'import platform; print platform.python_version()'`"'/g' < $(srcdir)/Info.plist.in > Info.plist

73
Mac/IDLE/idlemain.py Normal file
View File

@@ -0,0 +1,73 @@
"""
Bootstrap script for IDLE as an application bundle.
"""
import sys, os
# Change the current directory the user's home directory, that way we'll get
# a more useful default location in the open/save dialogs.
os.chdir(os.path.expanduser('~/Documents'))
# Make sure sys.executable points to the python interpreter inside the
# framework, instead of at the helper executable inside the application
# bundle (the latter works, but doesn't allow access to the window server)
#
# .../IDLE.app/
# Contents/
# MacOS/
# IDLE (a python script)
# Python{-32} (symlink)
# Resources/
# idlemain.py (this module)
# ...
#
# ../IDLE.app/Contents/MacOS/Python{-32} is symlinked to
# ..Library/Frameworks/Python.framework/Versions/m.n
# /Resources/Python.app/Contents/MacOS/Python{-32}
# which is the Python interpreter executable
#
# The flow of control is as follows:
# 1. IDLE.app is launched which starts python running the IDLE script
# 2. IDLE script exports
# PYTHONEXECUTABLE = .../IDLE.app/Contents/MacOS/Python{-32}
# (the symlink to the framework python)
# 3. IDLE script alters sys.argv and uses os.execve to replace itself with
# idlemain.py running under the symlinked python.
# This is the magic step.
# 4. During interpreter initialization, because PYTHONEXECUTABLE is defined,
# sys.executable may get set to an unuseful value.
#
# (Note that the IDLE script and the setting of PYTHONEXECUTABLE is
# generated automatically by bundlebuilder in the Python 2.x build.
# Also, IDLE invoked via command line, i.e. bin/idle, bypasses all of
# this.)
#
# Now fix up the execution environment before importing idlelib.
# Reset sys.executable to its normal value, the actual path of
# the interpreter in the framework, by following the symlink
# exported in PYTHONEXECUTABLE.
pyex = os.environ['PYTHONEXECUTABLE']
sys.executable = os.path.join(sys.prefix, 'bin', 'python%d.%d'%(sys.version_info[:2]))
# Remove any sys.path entries for the Resources dir in the IDLE.app bundle.
p = pyex.partition('.app')
if p[2].startswith('/Contents/MacOS/Python'):
sys.path = [value for value in sys.path if
value.partition('.app') != (p[0], p[1], '/Contents/Resources')]
# Unexport PYTHONEXECUTABLE so that the other Python processes started
# by IDLE have a normal sys.executable.
del os.environ['PYTHONEXECUTABLE']
# Look for the -psn argument that the launcher adds and remove it, it will
# only confuse the IDLE startup code.
for idx, value in enumerate(sys.argv):
if value.startswith('-psn_'):
del sys.argv[idx]
break
# Now it is safe to import idlelib.
from idlelib.PyShell import main
if __name__ == '__main__':
main()