From fe0703b87a8d0739ea213c2b639bf21520a75a65 Mon Sep 17 00:00:00 2001 From: Xavier de Gaye Date: Mon, 4 Dec 2017 12:24:53 +0100 Subject: [PATCH 1/3] bpo-32199: uuid.getnode() now returns the MAC address on Android --- Lib/uuid.py | 3 ++- .../next/Library/2017-12-04-12-23-26.bpo-32199.nGof4v.rst | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Library/2017-12-04-12-23-26.bpo-32199.nGof4v.rst diff --git a/Lib/uuid.py b/Lib/uuid.py index cb2bc092bdfcde..d5740f680adace 100644 --- a/Lib/uuid.py +++ b/Lib/uuid.py @@ -401,7 +401,8 @@ def _ifconfig_getnode(): def _ip_getnode(): """Get the hardware address on Unix by running ip.""" # This works on Linux with iproute2. - mac = _find_mac('ip', 'link list', [b'link/ether'], lambda i: i+1) + arg = 'link' if hasattr(sys, 'getandroidapilevel') else 'link list' + mac = _find_mac('ip', arg, [b'link/ether'], lambda i: i+1) if mac: return mac return None diff --git a/Misc/NEWS.d/next/Library/2017-12-04-12-23-26.bpo-32199.nGof4v.rst b/Misc/NEWS.d/next/Library/2017-12-04-12-23-26.bpo-32199.nGof4v.rst new file mode 100644 index 00000000000000..91862926ab3a26 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2017-12-04-12-23-26.bpo-32199.nGof4v.rst @@ -0,0 +1 @@ +uuid.getnode() now returns the MAC address on Android. From b2b7f25706786396b76a74e705824229a59ae0bd Mon Sep 17 00:00:00 2001 From: Xavier de Gaye Date: Thu, 7 Dec 2017 10:47:05 +0100 Subject: [PATCH 2/3] bpo-32199: The getnode() ip getter now uses 'ip link' --- Lib/uuid.py | 3 +-- .../next/Library/2017-12-04-12-23-26.bpo-32199.nGof4v.rst | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Lib/uuid.py b/Lib/uuid.py index d5740f680adace..33720a523ece87 100644 --- a/Lib/uuid.py +++ b/Lib/uuid.py @@ -401,8 +401,7 @@ def _ifconfig_getnode(): def _ip_getnode(): """Get the hardware address on Unix by running ip.""" # This works on Linux with iproute2. - arg = 'link' if hasattr(sys, 'getandroidapilevel') else 'link list' - mac = _find_mac('ip', arg, [b'link/ether'], lambda i: i+1) + mac = _find_mac('ip', 'link', [b'link/ether'], lambda i: i+1) if mac: return mac return None diff --git a/Misc/NEWS.d/next/Library/2017-12-04-12-23-26.bpo-32199.nGof4v.rst b/Misc/NEWS.d/next/Library/2017-12-04-12-23-26.bpo-32199.nGof4v.rst index 91862926ab3a26..2e14f57d64b6cf 100644 --- a/Misc/NEWS.d/next/Library/2017-12-04-12-23-26.bpo-32199.nGof4v.rst +++ b/Misc/NEWS.d/next/Library/2017-12-04-12-23-26.bpo-32199.nGof4v.rst @@ -1 +1 @@ -uuid.getnode() now returns the MAC address on Android. +The getnode() ip getter now uses 'ip link'. From 34f861d838f123e4ee73d69c7312ca671f431735 Mon Sep 17 00:00:00 2001 From: Xavier de Gaye Date: Thu, 7 Dec 2017 11:28:13 +0100 Subject: [PATCH 3/3] Update the NEWS entry --- .../next/Library/2017-12-04-12-23-26.bpo-32199.nGof4v.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2017-12-04-12-23-26.bpo-32199.nGof4v.rst b/Misc/NEWS.d/next/Library/2017-12-04-12-23-26.bpo-32199.nGof4v.rst index 2e14f57d64b6cf..d5f88cef5c7aa2 100644 --- a/Misc/NEWS.d/next/Library/2017-12-04-12-23-26.bpo-32199.nGof4v.rst +++ b/Misc/NEWS.d/next/Library/2017-12-04-12-23-26.bpo-32199.nGof4v.rst @@ -1 +1 @@ -The getnode() ip getter now uses 'ip link'. +The getnode() ip getter now uses 'ip link' instead of 'ip link list'.