File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -71,6 +71,49 @@ def is_on_macos_14_or_higher():
7171del is_on_macos_14_or_higher
7272
7373
74+ def is_on_macos_arm64 ():
75+ """
76+ Return True if the current OS is macOS running on Apple Silicon.
77+ """
78+ import platform
79+ return on_mac and platform .machine () == 'arm64'
80+
81+
82+ on_macos_arm64 = is_on_macos_arm64 ()
83+
84+ del is_on_macos_arm64
85+
86+
87+ def get_etc_os_release_info (os_release_path = '/etc/os-release' ):
88+ """
89+ Return a dictionary of keys-value pairs from /etc/os-release
90+ """
91+ cfg_kv = {}
92+ with open (os_release_path ) as f :
93+ for line in f :
94+ split_line = line .split ('=' )
95+ if not split_line :
96+ continue
97+ k = split_line [0 ].strip ()
98+ v = split_line [- 1 ].strip ()
99+ cfg_kv [k ] = v
100+ return cfg_kv
101+
102+
103+ def is_on_ubuntu_22 ():
104+ """
105+ Return True if the current OS is Ubuntu 22.XX.
106+ """
107+ if not on_linux :
108+ return False
109+ os_release_info = get_etc_os_release_info ()
110+ return os_release_info ['ID' ] == 'ubuntu' and '22' in os_release_info ['VERSION_ID' ]
111+
112+ on_ubuntu_22 = is_on_ubuntu_22 ()
113+
114+ del is_on_ubuntu_22
115+
116+
74117def has_case_sensitive_fs ():
75118 """
76119 Return True if the current FS is case sensitive.
You can’t perform that action at this time.
0 commit comments