Accepting request 1156190 from devel:languages:python

- 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/request/show/1156190
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-getmac?expand=0&rev=7
This commit is contained in:
2024-03-08 17:09:17 +00:00
committed by Git OBS Bridge
7 changed files with 60 additions and 74 deletions

13
cope-with-no-ip6.patch Normal file
View File

@@ -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):

View File

@@ -1,22 +0,0 @@
From: Antonio Larrosa <alarrosa@suse.com>
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)

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6e38f9023b9792f53ef982cce6be65d84fea656be87100ab2f2d0376563af486
size 50633

3
getmac-0.9.4.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8477755b69ff93a3b514b54e1fbb8ebb57d8f4e5c37e7c18bcef3a0f1f149232
size 94019

View File

@@ -1,3 +1,34 @@
-------------------------------------------------------------------
Fri Mar 8 00:58:45 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
- 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 <yarunachalam@suse.com>

View File

@@ -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

View File

@@ -1,30 +0,0 @@
From: Antonio Larrosa <alarrosa@suse.com>
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"