diff -r 96f08a22f562 Lib/uuid.py --- a/Lib/uuid.py Sat Feb 23 22:21:48 2013 -0500 +++ b/Lib/uuid.py Mon Feb 25 09:23:09 2013 +0200 @@ -357,6 +357,31 @@ return None +def _netstat_getnode(): + """Get the hardware address on AIX by running netstat. + See http://www.coffer.com/mac_info/locate-unix.html#aix + """ + command = 'netstat' + args = '-ia' + + import os + for dir in ['/usr/bin']: + executable = os.path.join(dir, command) + if not os.path.exists(executable): + continue + + try: + cmd = '%s %s 2>/dev/null' % (executable, args) + with os.popen(cmd) as pipe: + for line in pipe: + words = line.split() + for word in words: + if len(word) == 17 and word.count(':') == 5: + return int(word.replace(':', ''), 16) + except OSError: + continue + return None + def _ipconfig_getnode(): """Get the hardware address on Windows by running ipconfig.exe.""" import os, re @@ -496,7 +521,7 @@ if sys.platform == 'win32': getters = [_windll_getnode, _netbios_getnode, _ipconfig_getnode] else: - getters = [_unixdll_getnode, _ifconfig_getnode] + getters = [_unixdll_getnode, _ifconfig_getnode, _netstat_getnode] for getter in getters + [_random_getnode]: try: