aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gilbert <floppym@gentoo.org>2020-04-20 16:47:00 -0400
committerMike Gilbert <floppym@gentoo.org>2020-04-20 17:14:25 -0400
commit9738a404e876270cbdef2514f66915bce35d7435 (patch)
tree9fd2c92a62a4fe3a8ffa93486bf47a00faabaa98
parentspecial_env_vars: add ENV_UNSET to environ_whitelist (bug 700830) (diff)
downloadportage-9738a404e876270cbdef2514f66915bce35d7435.tar.gz
portage-9738a404e876270cbdef2514f66915bce35d7435.tar.bz2
portage-9738a404e876270cbdef2514f66915bce35d7435.zip
Import portage.util.netlink.RtNetlink in global scope
Bug: https://bugs.gentoo.org/718578 Signed-off-by: Mike Gilbert <floppym@gentoo.org> Reviewed-by: Zac Medico <zmedico@gentoo.org>
-rw-r--r--lib/portage/process.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/portage/process.py b/lib/portage/process.py
index 590116890..79052b608 100644
--- a/lib/portage/process.py
+++ b/lib/portage/process.py
@@ -28,6 +28,13 @@ from portage.exception import CommandNotFound
from portage.util._ctypes import find_library, LoadLibrary, ctypes
try:
+ from portage.util.netlink import RtNetlink
+except ImportError:
+ if platform.system() == "Linux":
+ raise
+ RtNetlink = None
+
+try:
import resource
max_fd_limit = resource.getrlimit(resource.RLIMIT_NOFILE)[0]
except ImportError:
@@ -504,8 +511,8 @@ def _configure_loopback_interface():
# Bug: https://bugs.gentoo.org/690758
# Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=12377#c13
- # Avoid importing this module on systems that may not support netlink sockets.
- from portage.util.netlink import RtNetlink
+ if RtNetlink is None:
+ return
try:
with RtNetlink() as rtnl: