Accepting request 705225 from devel:languages:python
OBS-URL: https://build.opensuse.org/request/show/705225 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-netifaces?expand=0&rev=14
This commit is contained in:
commit
559dc0391c
19
LICENSE
Normal file
19
LICENSE
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
Copyright (c) 2007-2018 Alastair Houghton
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:bd590fcb75421537d4149825e1e63cca225fd47dad861710c46bd1cb329d8cbd
|
|
||||||
size 29330
|
|
3
netifaces-0.10.9.tar.gz
Normal file
3
netifaces-0.10.9.tar.gz
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:2dee9ffdd16292878336a58d04a20f0ffe95555465fee7c9bd23b3490ef2abf3
|
||||||
|
size 28844
|
@ -1,3 +1,12 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri May 24 11:00:13 UTC 2019 - pgajdos@suse.com
|
||||||
|
|
||||||
|
- version update to 0.10.9
|
||||||
|
* Fixed a bug that in certain circumstances could lead to an infinite
|
||||||
|
loop in netifaces.gateways() (thanks asomers).
|
||||||
|
* Fixed a memory management bug in an error path (thanks NicoPy).
|
||||||
|
- created a small test
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Mon Sep 10 11:00:01 UTC 2018 - dmueller@suse.com
|
Mon Sep 10 11:00:01 UTC 2018 - dmueller@suse.com
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package python-netifaces
|
# spec file for package python-netifaces
|
||||||
#
|
#
|
||||||
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
|
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||||
# Copyright (c) 2011 Novell
|
# Copyright (c) 2011 Novell
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
@ -13,19 +13,22 @@
|
|||||||
# license that conforms to the Open Source Definition (Version 1.9)
|
# license that conforms to the Open Source Definition (Version 1.9)
|
||||||
# published by the Open Source Initiative.
|
# published by the Open Source Initiative.
|
||||||
|
|
||||||
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
||||||
Name: python-netifaces
|
Name: python-netifaces
|
||||||
Version: 0.10.7
|
Version: 0.10.9
|
||||||
Release: 0
|
Release: 0
|
||||||
Summary: Portable network interface information
|
Summary: Portable network interface information
|
||||||
License: MIT
|
License: MIT
|
||||||
Group: Development/Languages/Python
|
Group: Development/Languages/Python
|
||||||
Url: http://alastairs-place.net/projects/netifaces/
|
Url: https://github.com/al45tair/netifaces
|
||||||
Source: https://pypi.io/packages/source/n/netifaces/netifaces-%{version}.tar.gz
|
Source0: https://pypi.io/packages/source/n/netifaces/netifaces-%{version}.tar.gz
|
||||||
|
# https://github.com/al45tair/netifaces/issues/40
|
||||||
|
Source1: https://raw.githubusercontent.com/al45tair/netifaces/master/LICENSE
|
||||||
|
Source2: https://raw.githubusercontent.com/al45tair/netifaces/master/test.py
|
||||||
BuildRequires: %{python_module devel}
|
BuildRequires: %{python_module devel}
|
||||||
BuildRequires: %{python_module setuptools}
|
BuildRequires: %{python_module setuptools}
|
||||||
BuildRequires: python-rpm-macros
|
BuildRequires: python-rpm-macros
|
||||||
@ -48,6 +51,7 @@ provided by the socket options is normally less complete.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n netifaces-%{version}
|
%setup -q -n netifaces-%{version}
|
||||||
|
cp %{SOURCE1} %{SOURCE2} .
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%python_build
|
%python_build
|
||||||
@ -55,8 +59,12 @@ provided by the socket options is normally less complete.
|
|||||||
%install
|
%install
|
||||||
%python_install
|
%python_install
|
||||||
|
|
||||||
|
%check
|
||||||
|
%python_expand PYTHONPATH=%{buildroot}%{$python_sitearch} $python test.py | grep 'Interface lo'
|
||||||
|
|
||||||
%files %{python_files}
|
%files %{python_files}
|
||||||
%defattr(-,root,root,-)
|
%defattr(-,root,root,-)
|
||||||
|
%license LICENSE
|
||||||
%doc README.rst
|
%doc README.rst
|
||||||
%{python_sitearch}/*
|
%{python_sitearch}/*
|
||||||
|
|
||||||
|
50
test.py
Normal file
50
test.py
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
import netifaces
|
||||||
|
|
||||||
|
print('Found interfaces:')
|
||||||
|
for iface in netifaces.interfaces():
|
||||||
|
print(' %s' % iface)
|
||||||
|
|
||||||
|
print('')
|
||||||
|
|
||||||
|
for iface in netifaces.interfaces():
|
||||||
|
allAddrs = netifaces.ifaddresses(iface)
|
||||||
|
|
||||||
|
print('Interface %s:' % iface)
|
||||||
|
|
||||||
|
for family in allAddrs:
|
||||||
|
addrs = allAddrs[family]
|
||||||
|
fam_name = netifaces.address_families[family]
|
||||||
|
print(' Address family: %s' % fam_name)
|
||||||
|
for addr in addrs:
|
||||||
|
print(' Address : %s' % addr['addr'])
|
||||||
|
nmask = addr.get('netmask', None)
|
||||||
|
if nmask:
|
||||||
|
print(' Netmask : %s' % nmask)
|
||||||
|
bcast = addr.get('broadcast', None)
|
||||||
|
if bcast:
|
||||||
|
print(' Broadcast: %s' % bcast)
|
||||||
|
|
||||||
|
print('')
|
||||||
|
|
||||||
|
print('Found gateways:')
|
||||||
|
gateway_info = netifaces.gateways()
|
||||||
|
for family in gateway_info:
|
||||||
|
if family == 'default':
|
||||||
|
continue
|
||||||
|
|
||||||
|
fam_name = netifaces.address_families[family]
|
||||||
|
print(' Family: %s' % fam_name)
|
||||||
|
for gateway,interface,default in gateway_info[family]:
|
||||||
|
if default:
|
||||||
|
def_text = ', default'
|
||||||
|
else:
|
||||||
|
def_text = ''
|
||||||
|
print(' %s (via %s%s)' % (gateway, interface, def_text))
|
||||||
|
print('')
|
||||||
|
|
||||||
|
print('Default gateways:')
|
||||||
|
default_gateways = gateway_info['default']
|
||||||
|
for family in default_gateways:
|
||||||
|
fam_name = netifaces.address_families[family]
|
||||||
|
gateway, interface = default_gateways[family]
|
||||||
|
print(' %s: %s (via %s)' % (fam_name, gateway, interface))
|
Loading…
Reference in New Issue
Block a user