File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -88,14 +88,16 @@ jobs:
8888 - name : Install dependencies
8989 run : |
9090 uv pip install ifcfg getmac
91- - name : Set Windows System Locale and Culture
91+ - name : Windows test locale ${{ matrix.pair.test-locale }}
9292 run : |
93- Install-Language -Language ${{ matrix.pair.test-locale-id }}
94- Set-WinSystemLocale -SystemLocale ${{ matrix.pair.test-locale-id }}
95- Set-Culture -CultureInfo ${{ matrix.pair.test-locale-id }}
93+ $ErrorActionPreference = "Stop"
94+ $culture = [System.Globalization.CultureInfo]::GetCultureInfo('${{ matrix.pair.test-locale-id }}')
95+ [System.Threading.Thread]::CurrentThread.CurrentCulture = $culture
96+ [System.Threading.Thread]::CurrentThread.CurrentUICulture = $culture
97+ [System.Globalization.CultureInfo]::DefaultThreadCurrentCulture = $culture
98+ [System.Globalization.CultureInfo]::DefaultThreadCurrentUICulture = $culture
99+
100+ $env:LANG = '${{ matrix.pair.test-locale }}'
101+ $env:LC_ALL = '${{ matrix.pair.test-locale }}'
102+ uv run scripts/compare_mac_methods.py
96103 shell : pwsh
97- - name : Windows test locale ${{ matrix.pair.test-locale }}
98- env :
99- LANG : ${{ matrix.pair.test-locale }}
100- LC_ALL : ${{ matrix.pair.test-locale }}
101- run : uv run scripts/compare_mac_methods.py
Original file line number Diff line number Diff line change 88import sys
99
1010
11+ def _device_sort_key (iface ):
12+ """
13+ Sort interfaces by device name to give preference to interfaces
14+ that are more likely to be stable (not change/be removed).
15+ """
16+ dev = (iface .get ("device" ) or "" ).lower ()
17+ if dev .startswith ("eth" ) or dev .startswith ("en" ):
18+ return "0" + dev
19+ if dev .startswith ("wl" ):
20+ return "1" + dev
21+ if dev .startswith ("e" ) or dev .startswith ("w" ):
22+ return "2" + dev
23+ else :
24+ return dev
25+
26+
1127def get_system_language ():
1228 """Get system language settings"""
1329 try :
@@ -35,7 +51,7 @@ def get_ifcfg_macs():
3551
3652 interfaces = ifcfg .interfaces ().values ()
3753 results = {}
38- for iface in interfaces :
54+ for iface in sorted ( interfaces , key = _device_sort_key ) :
3955 ether = iface .get ("ether" )
4056 if ether :
4157 results [iface .get ("device" , "unknown" )] = ether
You can’t perform that action at this time.
0 commit comments