Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o, Mike Gilbert <floppym@g.o>, gentoo-poratge-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH] Import portage.util.netlink.RtNetlink in global scope
Date: Mon, 20 Apr 2020 21:09:00
Message-Id: eca130ee-c9e3-5256-162e-661cd8674682@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH] Import portage.util.netlink.RtNetlink in global scope by Mike Gilbert
1 On 4/20/20 1:50 PM, Mike Gilbert wrote:
2 > Bug: https://bugs.gentoo.org/718578
3 > Signed-off-by: Mike Gilbert <floppym@g.o>
4 > ---
5 > lib/portage/process.py | 11 +++++++++--
6 > 1 file changed, 9 insertions(+), 2 deletions(-)
7 >
8 > diff --git a/lib/portage/process.py b/lib/portage/process.py
9 > index 590116890..79052b608 100644
10 > --- a/lib/portage/process.py
11 > +++ b/lib/portage/process.py
12 > @@ -27,6 +27,13 @@ from portage.const import BASH_BINARY, SANDBOX_BINARY, FAKEROOT_BINARY
13 > from portage.exception import CommandNotFound
14 > from portage.util._ctypes import find_library, LoadLibrary, ctypes
15 >
16 > +try:
17 > + from portage.util.netlink import RtNetlink
18 > +except ImportError:
19 > + if platform.system() == "Linux":
20 > + raise
21 > + RtNetlink = None
22 > +
23 > try:
24 > import resource
25 > max_fd_limit = resource.getrlimit(resource.RLIMIT_NOFILE)[0]
26 > @@ -504,8 +511,8 @@ def _configure_loopback_interface():
27 > # Bug: https://bugs.gentoo.org/690758
28 > # Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=12377#c13
29 >
30 > - # Avoid importing this module on systems that may not support netlink sockets.
31 > - from portage.util.netlink import RtNetlink
32 > + if RtNetlink is None:
33 > + return
34 >
35 > try:
36 > with RtNetlink() as rtnl:
37 >
38
39 Looks good. Please merge.
40 --
41 Thanks,
42 Zac

Attachments

File name MIME type
signature.asc application/pgp-signature