@@ -526,13 +526,13 @@ def mac_ver(release='', versioninfo=('', '', ''), machine=''):
526526
527527
528528def ios_ver (system = "" , release = "" , model = "" , is_simulator = False ):
529- """Get iOS version information, and return it as a namedtuple:
530- (system, release, model, is_simulator).
529+ """Get iOS/tvOS/watchOS/visionOS version information, and return it as a
530+ namedtuple: (system, release, model, is_simulator).
531531
532532 If values can't be determined, they are set to values provided as
533533 parameters.
534534 """
535- if sys .platform == "ios" :
535+ if sys .platform in { "ios" , "tvos" , "visionos" , "watchos" } :
536536 import _ios_support
537537 result = _ios_support .get_platform_ios ()
538538 if result is not None :
@@ -685,7 +685,7 @@ def _syscmd_file(target, default=''):
685685 default in case the command should fail.
686686
687687 """
688- if sys .platform in {'dos' , 'win32' , 'win16' , 'ios' , 'tvos' , 'watchos' }:
688+ if sys .platform in {'dos' , 'win32' , 'win16' , 'ios' , 'tvos' , 'visionos' , ' watchos' }:
689689 # XXX Others too ?
690690 return default
691691
@@ -849,14 +849,30 @@ def get_OpenVMS():
849849 csid , cpu_number = vms_lib .getsyi ('SYI$_CPU' , 0 )
850850 return 'Alpha' if cpu_number >= 128 else 'VAX'
851851
852- # On the iOS simulator, os.uname returns the architecture as uname.machine.
853- # On device it returns the model name for some reason; but there's only one
854- # CPU architecture for iOS devices, so we know the right answer.
852+ # On the iOS/tvOS/visionOS/watchOS simulator, os.uname returns the
853+ # architecture as uname.machine. On device it returns the model name for
854+ # some reason; but there's only one CPU architecture for devices, so we know
855+ # the right answer.
855856 def get_ios ():
856857 if sys .implementation ._multiarch .endswith ("simulator" ):
857858 return os .uname ().machine
858859 return 'arm64'
859860
861+ def get_tvos ():
862+ if sys .implementation ._multiarch .endswith ("simulator" ):
863+ return os .uname ().machine
864+ return 'arm64'
865+
866+ def get_visionos ():
867+ if sys .implementation ._multiarch .endswith ("simulator" ):
868+ return os .uname ().machine
869+ return 'arm64'
870+
871+ def get_watchos ():
872+ if sys .implementation ._multiarch .endswith ("simulator" ):
873+ return os .uname ().machine
874+ return 'arm64_32'
875+
860876 def from_subprocess ():
861877 """
862878 Fall back to `uname -p`
@@ -1009,8 +1025,8 @@ def uname():
10091025 system = 'Android'
10101026 release = android_ver ().release
10111027
1012- # Normalize responses on iOS
1013- if sys .platform == ' ios' :
1028+ # Normalize responses on Apple mobile platforms
1029+ if sys .platform in { " ios" , "tvos" , "visionos" , "watchos" } :
10141030 system , release , _ , _ = ios_ver ()
10151031
10161032 vals = system , node , release , version , machine
@@ -1299,7 +1315,7 @@ def platform(aliased=False, terse=False):
12991315
13001316 if system == 'Darwin' :
13011317 # macOS and iOS both report as a "Darwin" kernel
1302- if sys .platform == "ios" :
1318+ if sys .platform in { "ios" , "tvos" , "visionos" , "watchos" } :
13031319 system , release , _ , _ = ios_ver ()
13041320 else :
13051321 macos_release = mac_ver ()[0 ]
0 commit comments