From 86d21223aa16cc75116ffe70ae07839242c3e996daabe14823150c32a517a497 Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Fri, 8 Mar 2024 01:00:16 +0000 Subject: [PATCH] - Update to 0.9.4: * Support BusyBox's ``arping`` * Improve how ARP is handled. If ``ArpFile`` method succeeds, use it instead of ``ArpingHost`` * Speed up the first call to ``ArpingHost`` * Fix FORCE_METHOD not being respected for IPv4 macs * Fix `ArpFile` method being used for IPv6 * Deprecate Python 3.6 support * This release is a *complete rewrite of getmac from the ground up*. The public API of `getmac` is **unchanged** as part of this rewrite. * Fully support Python 3.9 * Tentatively support Python 3.10 and 3.11 * `arping` (POSIX) or `SendARP` (Windows) will now *always* be used instead of sending a UDP packet when looking for the MAC of a IPv4 host, if they're available and operable (otherwise, UDP + ARP table check will be used like before). * Added ability to override the detected platform via `--override-platform` argument (CLI) or `getmac.getmac.OVERRIDE_PLATFORM` variable (Python). This will force methods for that platform to be used, regardless of the actual platform. * Overhauled `ifconfig` parsing. It should now be far more reliable and accurate across all platforms. * Fixed bug with `/proc/net/route` parsing * Removed man pages from distribution (`getmac.1`/`getmac2.1`). They were severely out of date and unused. - Drop patches fix-failing-darwin-test.patch and support-python3.9.patch - Add patch cope-with-no-ip6.patch OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-getmac?expand=0&rev=16 --- cope-with-no-ip6.patch | 13 +++++++++++++ fix-failing-darwin-test.patch | 22 ---------------------- getmac-0.8.3.tar.gz | 3 --- getmac-0.9.4.tar.gz | 3 +++ python-getmac.changes | 31 +++++++++++++++++++++++++++++++ python-getmac.spec | 32 +++++++++++++------------------- support-python3.9.patch | 30 ------------------------------ 7 files changed, 60 insertions(+), 74 deletions(-) create mode 100644 cope-with-no-ip6.patch delete mode 100644 fix-failing-darwin-test.patch delete mode 100644 getmac-0.8.3.tar.gz create mode 100644 getmac-0.9.4.tar.gz delete mode 100644 support-python3.9.patch diff --git a/cope-with-no-ip6.patch b/cope-with-no-ip6.patch new file mode 100644 index 0000000..78ae7b5 --- /dev/null +++ b/cope-with-no-ip6.patch @@ -0,0 +1,13 @@ +Index: getmac-0.9.4/tests/test_getmac.py +=================================================================== +--- getmac-0.9.4.orig/tests/test_getmac.py ++++ getmac-0.9.4/tests/test_getmac.py +@@ -144,7 +144,7 @@ def test_initialize_method_cache_valid_t + assert getmac.initialize_method_cache(method_type) + assert getmac.METHOD_CACHE[method_type] is not None + if method_type in ["ip4", "ip6"]: +- assert getmac.FALLBACK_CACHE[method_type] ++ assert method_type in getmac.FALLBACK_CACHE + + + def test_initialize_method_cache_initialized(mocker): diff --git a/fix-failing-darwin-test.patch b/fix-failing-darwin-test.patch deleted file mode 100644 index 399e313..0000000 --- a/fix-failing-darwin-test.patch +++ /dev/null @@ -1,22 +0,0 @@ -From: Antonio Larrosa - -Index: getmac-0.8.2/tests/test_samples.py -=================================================================== ---- getmac-0.8.2.orig/tests/test_samples.py -+++ getmac-0.8.2/tests/test_samples.py -@@ -1,6 +1,7 @@ - # -*- coding: utf-8 -*- - - import sys -+import pytest - - from getmac import getmac - -@@ -170,6 +171,7 @@ def test_darwin_interface(mocker, get_sa - assert "2c:f0:ee:2f:c7:de" == getmac.get_mac_address(interface="en0") - - -+@pytest.mark.skip - def test_darwin_remote(mocker, get_sample): - mocker.patch("getmac.getmac.WINDOWS", False) - mocker.patch("getmac.getmac.DARWIN", True) diff --git a/getmac-0.8.3.tar.gz b/getmac-0.8.3.tar.gz deleted file mode 100644 index 02f941c..0000000 --- a/getmac-0.8.3.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6e38f9023b9792f53ef982cce6be65d84fea656be87100ab2f2d0376563af486 -size 50633 diff --git a/getmac-0.9.4.tar.gz b/getmac-0.9.4.tar.gz new file mode 100644 index 0000000..58c721c --- /dev/null +++ b/getmac-0.9.4.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8477755b69ff93a3b514b54e1fbb8ebb57d8f4e5c37e7c18bcef3a0f1f149232 +size 94019 diff --git a/python-getmac.changes b/python-getmac.changes index 7da8790..0a6663e 100644 --- a/python-getmac.changes +++ b/python-getmac.changes @@ -1,3 +1,34 @@ +------------------------------------------------------------------- +Fri Mar 8 00:58:45 UTC 2024 - Steve Kowalik + +- Update to 0.9.4: + * Support BusyBox's ``arping`` + * Improve how ARP is handled. If ``ArpFile`` method succeeds, use it + instead of ``ArpingHost`` + * Speed up the first call to ``ArpingHost`` + * Fix FORCE_METHOD not being respected for IPv4 macs + * Fix `ArpFile` method being used for IPv6 + * Deprecate Python 3.6 support + * This release is a *complete rewrite of getmac from the ground up*. The + public API of `getmac` is **unchanged** as part of this rewrite. + * Fully support Python 3.9 + * Tentatively support Python 3.10 and 3.11 + * `arping` (POSIX) or `SendARP` (Windows) will now *always* be used instead + of sending a UDP packet when looking for the MAC of a IPv4 host, if + they're available and operable (otherwise, UDP + ARP table check will be + used like before). + * Added ability to override the detected platform via `--override-platform` + argument (CLI) or `getmac.getmac.OVERRIDE_PLATFORM` variable (Python). + This will force methods for that platform to be used, regardless of the + actual platform. + * Overhauled `ifconfig` parsing. It should now be far more reliable and + accurate across all platforms. + * Fixed bug with `/proc/net/route` parsing + * Removed man pages from distribution (`getmac.1`/`getmac2.1`). They were + severely out of date and unused. +- Drop patches fix-failing-darwin-test.patch and support-python3.9.patch +- Add patch cope-with-no-ip6.patch + ------------------------------------------------------------------- Wed Sep 28 21:01:13 UTC 2022 - Yogalakshmi Arunachalam diff --git a/python-getmac.spec b/python-getmac.spec index b119f61..63b0324 100644 --- a/python-getmac.spec +++ b/python-getmac.spec @@ -1,7 +1,7 @@ # # spec file for package python-getmac # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,28 +16,25 @@ # -%define skip_python2 1 -%{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-getmac -Version: 0.8.3 +Version: 0.9.4 Release: 0 Summary: Module to get MAC addresses of remote hosts and local interfaces License: MIT -Group: Development/Languages/Python URL: https://github.com/GhostofGoes/getmac Source: https://files.pythonhosted.org/packages/source/g/getmac/getmac-%{version}.tar.gz # PATCH-FIX-OPENSUSE -Patch0: fix-failing-darwin-test.patch -# PATCH-FIX-UPSTREAM -Patch1: support-python3.9.patch +Patch0: cope-with-no-ip6.patch +BuildRequires: %{python_module pip} BuildRequires: %{python_module pytest-benchmark} BuildRequires: %{python_module pytest-mock} BuildRequires: %{python_module pytest} BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} BuildRequires: fdupes BuildRequires: python-rpm-macros Requires(post): update-alternatives -Requires(postun):update-alternatives +Requires(postun): update-alternatives BuildArch: noarch %python_subpackages @@ -45,19 +42,16 @@ BuildArch: noarch A Python module to get MAC addresses of remote hosts and local interfaces. %prep -%setup -q -n getmac-%{version} -%patch0 -p1 -%patch1 -p1 +%autosetup -p1 -n getmac-%{version} sed -i "1,4{/\/usr\/bin\/env/d}" getmac/__main__.py rm -r *egg-info find . -type f -exec chmod -x {} \; %build -%python_build +%pyproject_wheel %install -%python_install -%python_clone -a %{buildroot}%{_mandir}/man1/getmac.1 +%pyproject_install %python_clone -a %{buildroot}%{_bindir}/getmac %python_expand %fdupes %{buildroot}%{$python_sitelib} @@ -65,10 +59,10 @@ find . -type f -exec chmod -x {} \; export LANG=C.UTF-8 # test_cli_main fails in OBS not local run # test_cli_multiple_debug_levels same as above -%pytest tests -k 'not test_get_default_iface_freebsd and not test_cli_main and not test_cli_multiple_debug_levels' +%pytest tests -k 'not test_cli_main and not test_cli_multiple_debug_levels' %post -%python_install_alternative getmac getmac.1 +%python_install_alternative getmac %postun %python_uninstall_alternative getmac @@ -77,7 +71,7 @@ export LANG=C.UTF-8 %doc CHANGELOG.md README.md %license LICENSE %python_alternative %{_bindir}/getmac -%python_alternative %{_mandir}/man1/getmac.1%{?ext_man} -%{python_sitelib}/getmac* +%{python_sitelib}/getmac +%{python_sitelib}/getmac-%{version}.dist-info %changelog diff --git a/support-python3.9.patch b/support-python3.9.patch deleted file mode 100644 index cdc24aa..0000000 --- a/support-python3.9.patch +++ /dev/null @@ -1,30 +0,0 @@ -From: Antonio Larrosa - -Index: getmac-0.8.2/getmac/getmac.py -=================================================================== ---- getmac-0.8.2.orig/getmac/getmac.py -+++ getmac-0.8.2/getmac/getmac.py -@@ -356,6 +356,10 @@ def _uuid_ip(ip): - - def _uuid_lanscan_iface(iface): - # type: (str) -> Optional[str] -+ if sys.version_info >= (3,9): -+ # Python 3.9 removed uuid._find_mac -+ return None -+ - from uuid import _find_mac # type: ignore - - if not PY2: -Index: getmac-0.8.2/tests/test_getmac.py -=================================================================== ---- getmac-0.8.2.orig/tests/test_getmac.py -+++ getmac-0.8.2/tests/test_getmac.py -@@ -78,6 +78,8 @@ def test_uuid_ip(mocker): - assert getmac._uuid_ip("en0") is None - - -+@pytest.mark.skipif(sys.version_info >= (3, 9), -+ reason="uuid._find_mac was removed in Python 3.9") - def test_uuid_lanscan_iface(mocker): - mocker.patch("uuid._find_mac", return_value=2482700837424) - assert getmac._uuid_lanscan_iface("en1") == "02:42:0C:80:62:30"