Skip to content
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
f4810d9
patch for xrOS
johnzhou721 Apr 13, 2025
23f9fc2
Update configure.ac
johnzhou721 Apr 13, 2025
477f798
modify to visionOS
johnzhou721 Apr 13, 2025
cdc75e1
Merge remote-tracking branch 'origin/3.14-patched' into 3.14-patched
johnzhou721 Apr 13, 2025
001a168
autoreconf using the docker i guess
johnzhou721 Apr 13, 2025
2bf2add
file business
johnzhou721 Apr 13, 2025
3183f22
config.sub
johnzhou721 Apr 13, 2025
5c216d3
filenames
johnzhou721 Apr 13, 2025
30e92fb
some changes
johnzhou721 Apr 13, 2025
cc6d47d
Configure and make now runs correctly
johnzhou721 Apr 13, 2025
d15e059
remove info.plist i guess
johnzhou721 Apr 13, 2025
94434ec
update visionos in lib
johnzhou721 Apr 13, 2025
7e8c1c6
xrOS
johnzhou721 Apr 14, 2025
e4538ed
remove unnessacary disablement of commands
johnzhou721 Apr 14, 2025
62f5e08
more enablement
johnzhou721 Apr 14, 2025
c5dab98
Add platform triplet
johnzhou721 Apr 14, 2025
f805bde
comments and version
johnzhou721 Apr 15, 2025
d5df89f
export visionOS deployment
johnzhou721 Apr 15, 2025
7900c23
add (probably) nonworking testbed
johnzhou721 Apr 15, 2025
ce466a9
consistency
johnzhou721 Apr 16, 2025
f4f92ce
Add testvisionos
johnzhou721 Apr 17, 2025
89f8719
Remove more iOS refs.
johnzhou721 Apr 17, 2025
4cd23bd
Platform identification on visionOS.
johnzhou721 Apr 17, 2025
641a8d5
Add more visionos references that were missing.
johnzhou721 Apr 18, 2025
5c7bb69
fix an outdated re
johnzhou721 Apr 18, 2025
b2932d9
Remove some debug statements
johnzhou721 Apr 18, 2025
58cc3b5
lower/upper
johnzhou721 Apr 19, 2025
4388757
code styl
johnzhou721 Apr 20, 2025
b20ce5b
Remove reference to LaunchScreen storyboard.
johnzhou721 Apr 21, 2025
5df4700
fix simulator detection
johnzhou721 Apr 21, 2025
b234a61
fix some more tests
johnzhou721 Apr 21, 2025
740c818
plist cleanup
johnzhou721 Apr 21, 2025
379c3d9
fix typo
johnzhou721 Apr 21, 2025
f3286a5
test: Resolve situation on iOS regarding fd_count.
johnzhou721 Apr 23, 2025
c0ce04a
Final test cleanups for visionOS.
freakboy3742 Apr 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ Lib/test/data/*
/Makefile
/Makefile.pre
/iOSTestbed.*
/visionOSTestbed.*
iOS/Frameworks/
iOS/Resources/Info.plist
iOS/testbed/build
Expand All @@ -80,10 +81,19 @@ iOS/testbed/Python.xcframework/ios-*/Python.framework
iOS/testbed/iOSTestbed.xcodeproj/project.xcworkspace
iOS/testbed/iOSTestbed.xcodeproj/xcuserdata
iOS/testbed/iOSTestbed.xcodeproj/xcshareddata
visionOS/testbed/Python.xcframework/xr*-*/bin
visionOS/testbed/Python.xcframework/xr*-*/include
visionOS/testbed/Python.xcframework/xr*-*/lib
visionOS/testbed/Python.xcframework/xr*-*/Python.framework
visionOS/testbed/visionOSTestbed.xcodeproj/project.xcworkspace
visionOS/testbed/visionOSTestbed.xcodeproj/xcuserdata
visionOS/testbed/visionOSTestbed.xcodeproj/xcshareddata
tvOS/Frameworks
tvOS/Resources/Info.plist
watchOS/Frameworks
watchOS/Resources/Info.plist
visionOS/Frameworks
visionOS/Resources/Info.plist
Mac/Makefile
Mac/PythonLauncher/Info.plist
Mac/PythonLauncher/Makefile
Expand Down
2 changes: 1 addition & 1 deletion Lib/ctypes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ def __init__(self, name, mode=DEFAULT_MODE, handle=None,
if name:
name = _os.fspath(name)

# If the filename that has been provided is an iOS/tvOS/watchOS
# If the filename that has been provided is an iOS/tvOS/watchOS/visionOS
# .fwork file, dereference the location to the true origin of the
# binary.
if name.endswith(".fwork"):
Expand Down
4 changes: 2 additions & 2 deletions Lib/ctypes/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def dllist():
if (name := _get_module_filename(h)) is not None]
return libraries

elif os.name == "posix" and sys.platform in {"darwin", "ios", "tvos", "watchos"}:
elif os.name == "posix" and sys.platform in {"darwin", "ios", "tvos", "watchos", "visionos"}:
from ctypes.macholib.dyld import dyld_find as _dyld_find
def find_library(name):
possible = ['lib%s.dylib' % name,
Expand Down Expand Up @@ -425,7 +425,7 @@ def find_library(name):
# https://man.openbsd.org/dl_iterate_phdr
# https://docs.oracle.com/cd/E88353_01/html/E37843/dl-iterate-phdr-3c.html
if (os.name == "posix" and
sys.platform not in {"darwin", "ios", "tvos", "watchos"}):
sys.platform not in {"darwin", "ios", "tvos", "watchos", "visionos"}):
import ctypes
if hasattr((_libc := ctypes.CDLL(None)), "dl_iterate_phdr"):

Expand Down
4 changes: 2 additions & 2 deletions Lib/importlib/_bootstrap_external.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

# Bootstrap-related code ######################################################
_CASE_INSENSITIVE_PLATFORMS_STR_KEY = 'win',
_CASE_INSENSITIVE_PLATFORMS_BYTES_KEY = 'cygwin', 'darwin', 'ios', 'tvos', 'watchos'
_CASE_INSENSITIVE_PLATFORMS_BYTES_KEY = 'cygwin', 'darwin', 'ios', 'tvos', 'watchos', 'visionos'
_CASE_INSENSITIVE_PLATFORMS = (_CASE_INSENSITIVE_PLATFORMS_BYTES_KEY
+ _CASE_INSENSITIVE_PLATFORMS_STR_KEY)

Expand Down Expand Up @@ -1535,7 +1535,7 @@ def _get_supported_file_loaders():
"""
extension_loaders = []
if hasattr(_imp, 'create_dynamic'):
if sys.platform in {"ios", "tvos", "watchos"}:
if sys.platform in {"ios", "tvos", "watchos", "visionos"}:
extension_loaders = [(AppleFrameworkLoader, [
suffix.replace(".so", ".fwork")
for suffix in _imp.extension_suffixes()
Expand Down
37 changes: 35 additions & 2 deletions Lib/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,30 @@ def watchos_ver(system="", release="", model="", is_simulator=False):
return WatchOSVersionInfo(system, release, model, is_simulator)


# A namedtuple for visionOS version information.
VisionOSVersionInfo = collections.namedtuple(
"VisionOSVersionInfo",
["system", "release", "model", "is_simulator"]
)


def visionos_ver(system="", release="", model="", is_simulator=False):
"""Get visionOS version information, and return it as a namedtuple:
(system, release, model, is_simulator).

If values can't be determined, they are set to values provided as
parameters.
"""
if sys.platform == "visionos":
# TODO: Can the iOS implementation be used here?
import _ios_support
result = _ios_support.get_platform_ios()
if result is not None:
return VisionOSVersionInfo(*result)

return VisionOSVersionInfo(system, release, model, is_simulator)


def _java_getprop(name, default):
"""This private helper is deprecated in 3.13 and will be removed in 3.15"""
from java.lang import System
Expand Down Expand Up @@ -768,7 +792,7 @@ def _syscmd_file(target, default=''):
default in case the command should fail.

"""
if sys.platform in {'dos', 'win32', 'win16', 'ios', 'tvos', 'watchos'}:
if sys.platform in {'dos', 'win32', 'win16', 'ios', 'tvos', 'watchos', 'visionos'}:
# XXX Others too ?
return default

Expand Down Expand Up @@ -932,7 +956,7 @@ def get_OpenVMS():
csid, cpu_number = vms_lib.getsyi('SYI$_CPU', 0)
return 'Alpha' if cpu_number >= 128 else 'VAX'

# On the iOS/tvOS/watchOS simulator, os.uname returns the architecture as
# On the iOS/tvOS/watchOS/visionOS simulator, os.uname returns the architecture as
# uname.machine. On device it returns the model name for some reason; but
# there's only one CPU architecture for devices, so we know the right
# answer.
Expand All @@ -951,6 +975,11 @@ def get_watchos():
return os.uname().machine
return 'arm64_32'

def get_visionos():
if sys.implementation._multiarch.endswith("simulator"):
return os.uname().machine
return 'arm64'

def from_subprocess():
"""
Fall back to `uname -p`
Expand Down Expand Up @@ -1117,6 +1146,8 @@ def uname():
system, release, _, _ = tvos_ver()
if sys.platform == 'watchos':
system, release, _, _ = watchos_ver()
if sys.platform == 'visionos':
system, release, _, _ = visionos_ver()

vals = system, node, release, version, machine
# Replace 'unknown' values with the more portable ''
Expand Down Expand Up @@ -1410,6 +1441,8 @@ def platform(aliased=False, terse=False):
system, release, _, _ = tvos_ver()
elif sys.platform == "watchos":
system, release, _, _ = watchos_ver()
elif sys.platform == "visionos":
system, release, _, _ = visionos_ver()
else:
macos_release = mac_ver()[0]
if macos_release:
Expand Down
4 changes: 2 additions & 2 deletions Lib/site.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,8 @@ def _getuserbase():
if env_base:
return env_base

# Emscripten, iOS, tvOS, VxWorks, WASI, and watchOS have no home directories
if sys.platform in {"emscripten", "ios", "tvos", "vxworks", "wasi", "watchos"}:
# Emscripten, iOS, tvOS, visionOS, VxWorks, WASI, and watchOS have no home directories
if sys.platform in {"emscripten", "ios", "tvos", "vxworks", "visionos", "wasi", "watchos"}:
return None

def joinuser(*args):
Expand Down
2 changes: 1 addition & 1 deletion Lib/subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
_mswindows = True

# some platforms do not support subprocesses
_can_fork_exec = sys.platform not in {"emscripten", "wasi", "ios", "tvos", "watchos"}
_can_fork_exec = sys.platform not in {"emscripten", "wasi", "ios", "tvos", "watchos", "visionos"}

if _mswindows:
import _winapi
Expand Down
9 changes: 8 additions & 1 deletion Lib/sysconfig/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
_ALWAYS_STR = {
'IPHONEOS_DEPLOYMENT_TARGET',
'MACOSX_DEPLOYMENT_TARGET',
'TVOS_DEPLOYMENT_TARGET',
'WATCHOS_DEPLOYMENT_TARGET',
'XROS_DEPLOYMENT_TARGET',
}

_INSTALL_SCHEMES = {
Expand Down Expand Up @@ -119,7 +122,7 @@ def _getuserbase():
# Emscripten, iOS, tvOS, VxWorks, WASI, and watchOS have no home directories.
# Use _PYTHON_HOST_PLATFORM to get the correct platform when cross-compiling.
system_name = os.environ.get('_PYTHON_HOST_PLATFORM', sys.platform).split('-')[0]
if system_name in {"emscripten", "ios", "tvos", "vxworks", "wasi", "watchos"}:
if system_name in {"emscripten", "ios", "tvos", "visionos", "vxworks", "wasi", "watchos"}:
return None

def joinuser(*args):
Expand Down Expand Up @@ -727,6 +730,10 @@ def get_platform():
release = get_config_vars().get("WATCHOS_DEPLOYMENT_TARGET", "4.0")
osname = sys.platform
machine = sys.implementation._multiarch
elif sys.platform == "visionos":
release = get_config_vars().get("XROS_DEPLOYMENT_TARGET", "2.0")
osname = sys.platform
machine = sys.implementation._multiarch
else:
import _osx_support
osname, release, machine = _osx_support.get_platform_osx(
Expand Down
4 changes: 2 additions & 2 deletions Lib/test/support/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ def skip_android_selinux(name):
sys.platform == "android", f"Android blocks {name} with SELinux"
)

if sys.platform not in {"win32", "vxworks", "ios", "tvos", "watchos"}:
if sys.platform not in {"win32", "vxworks", "ios", "tvos", "watchos", "visionos"}:
unix_shell = '/system/bin/sh' if is_android else '/bin/sh'
else:
unix_shell = None
Expand All @@ -560,7 +560,7 @@ def skip_emscripten_stack_overflow():
def skip_wasi_stack_overflow():
return unittest.skipIf(is_wasi, "Exhausts stack on WASI")

is_apple_mobile = sys.platform in {"ios", "tvos", "watchos"}
is_apple_mobile = sys.platform in {"ios", "tvos", "watchos", "visionos"}
is_apple = is_apple_mobile or sys.platform == "darwin"

has_fork_support = hasattr(os, "fork") and not (
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_ctypes/test_dllist.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


WINDOWS = os.name == "nt"
APPLE = sys.platform in {"darwin", "ios", "tvos", "watchos"}
APPLE = sys.platform in {"darwin", "ios", "tvos", "watchos", "visionos"}

if WINDOWS:
KNOWN_LIBRARIES = ["KERNEL32.DLL"]
Expand Down
44 changes: 40 additions & 4 deletions Makefile.pre.in
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,12 @@ MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
# the build, and is only listed here so it will be included in sysconfigdata.
IPHONEOS_DEPLOYMENT_TARGET=@IPHONEOS_DEPLOYMENT_TARGET@

# visionOS Deployment target is *actually* used during the build, by the
# compiler shims; export.
XROS_DEPLOYMENT_TARGET=@XROS_DEPLOYMENT_TARGET@
@EXPORT_XROS_DEPLOYMENT_TARGET@export XROS_DEPLOYMENT_TARGET


# Option to install to strip binaries
STRIPFLAG=-s

Expand Down Expand Up @@ -2149,7 +2155,7 @@ testuniversal: all
# a full Xcode install that has an iPhone SE (3rd edition) simulator available.
# This must be run *after* a `make install` has completed the build. The
# `--with-framework-name` argument *cannot* be used when configuring the build.
XCFOLDER:=iOSTestbed.$(MULTIARCH).$(shell date +%s).$$PPID
XCFOLDER-iOS:=iOSTestbed.$(MULTIARCH).$(shell date +%s).$$PPID
.PHONY: testios
testios:
@if test "$(MACHDEP)" != "ios"; then \
Expand All @@ -2169,11 +2175,41 @@ testios:
exit 1;\
fi

# Clone the testbed project into the XCFOLDER
$(PYTHON_FOR_BUILD) $(srcdir)/iOS/testbed clone --framework $(PYTHONFRAMEWORKPREFIX) "$(XCFOLDER)"
# Clone the testbed project into the XCFOLDER-iOS
$(PYTHON_FOR_BUILD) $(srcdir)/iOS/testbed clone --framework $(PYTHONFRAMEWORKPREFIX) "$(XCFOLDER-iOS)"

# Run the testbed project
$(PYTHON_FOR_BUILD) "$(XCFOLDER-iOS)" run --verbose -- test -uall --single-process --rerun -W

# Run the test suite on the visionOS simulator. Must be run on a macOS machine with
# a full Xcode install that has an Apple Vision Pro simulator available.
# This must be run *after* a `make install` has completed the build. The
# `--with-framework-name` argument *cannot* be used when configuring the build.
XCFOLDER-visionOS:=visionOSTestbed.$(MULTIARCH).$(shell date +%s).$$PPID
.PHONY: testvisionos
testvisionos:
@if test "$(MACHDEP)" != "visionos"; then \
echo "Cannot run the visionOS testbed for a non-visionOS build."; \
exit 1;\
fi
@if test "$(findstring -xrsimulator,$(MULTIARCH))" != "-xrsimulator"; then \
echo "Cannot run the visionOS testbed for non-simulator builds."; \
exit 1;\
fi
@if test $(PYTHONFRAMEWORK) != "Python"; then \
echo "Cannot run the visionOS testbed with a non-default framework name."; \
exit 1;\
fi
@if ! test -d $(PYTHONFRAMEWORKPREFIX); then \
echo "Cannot find a finalized visionOS Python.framework. Have you run 'make install' to finalize the framework build?"; \
exit 1;\
fi

# Clone the testbed project into the XCFOLDER-visionOS
$(PYTHON_FOR_BUILD) $(srcdir)/visionOS/testbed clone --framework $(PYTHONFRAMEWORKPREFIX) "$(XCFOLDER-visionOS)"

# Run the testbed project
$(PYTHON_FOR_BUILD) "$(XCFOLDER)" run --verbose -- test -uall --single-process --rerun -W
$(PYTHON_FOR_BUILD) "$(XCFOLDER-visionOS)" run --verbose -- test -uall --single-process --rerun -W

# Like test, but using --slow-ci which enables all test resources and use
# longer timeout. Run an optional pybuildbot.identify script to include
Expand Down
6 changes: 6 additions & 0 deletions Misc/platform_triplet.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,12 @@ PLATFORM_TRIPLET=arm64-watchsimulator
# else
PLATFORM_TRIPLET=arm64_32-watchos
# endif
# elif defined(TARGET_OS_VISION) && TARGET_OS_VISION
# if defined(TARGET_OS_SIMULATOR) && TARGET_OS_SIMULATOR
PLATFORM_TRIPLET=arm64-xrsimulator
# else
PLATFORM_TRIPLET=arm64-xros
# endif
// Older macOS SDKs do not define TARGET_OS_OSX
# elif !defined(TARGET_OS_OSX) || TARGET_OS_OSX
PLATFORM_TRIPLET=darwin
Expand Down
4 changes: 2 additions & 2 deletions config.sub
Original file line number Diff line number Diff line change
Expand Up @@ -1743,7 +1743,7 @@ case $os in
| hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
| sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \
| hiux* | abug | nacl* | netware* | windows* \
| os9* | macos* | osx* | ios* | tvos* | watchos* \
| os9* | macos* | osx* | ios* | tvos* | watchos* | xros* \
| mpw* | magic* | mmixware* | mon960* | lnews* \
| amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \
| aos* | aros* | cloudabi* | sortix* | twizzler* \
Expand Down Expand Up @@ -1867,7 +1867,7 @@ case $kernel-$os-$obj in
;;
*-eabi*- | *-gnueabi*-)
;;
ios*-simulator- | tvos*-simulator- | watchos*-simulator- )
ios*-simulator- | tvos*-simulator- | watchos*-simulator- | xros*-simulator-)
;;
none--*)
# None (no kernel, i.e. freestanding / bare metal),
Expand Down
Loading