File 0002-Fix-socket.SO_PEERCRED-constant-fallback-PowerPC.patch of Package python-cheroot.33628

From 86957eb6b4fa2e4aeacb23145077a8effb13c27c Mon Sep 17 00:00:00 2001
From: Sviatoslav Sydorenko <wk@sydorenko.org.ua>
Date: Wed, 4 Sep 2019 23:41:18 +0200
Subject: [PATCH] Fix socket.SO_PEERCRED constant fallback @ PowerPC

Resolves #222

Refs:
https://bugzilla.redhat.com/show_bug.cgi?id=1733967
https://www.mail-archive.com/devel@lists.fedoraproject.org/msg136822.html
http://ftp.linuxfoundation.org/pub/lsb/lsb-openjdk/openjdk7-lsb-overrides/lsb_flags.h
https://git.wukl.net/wukl/uefi-musl/blob/29ec7677a73a5227badbb1064205be09e707e466/arch/powerpc/bits/socket.h
---
 cheroot/_compat.py | 3 +++
 cheroot/server.py  | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/cheroot/_compat.py b/cheroot/_compat.py
index d1d1af6c..7f40c755 100644
--- a/cheroot/_compat.py
+++ b/cheroot/_compat.py
@@ -24,6 +24,9 @@ IS_WINDOWS = SYS_PLATFORM == 'Windows'
 IS_LINUX = SYS_PLATFORM == 'Linux'
 IS_MACOS = SYS_PLATFORM == 'Darwin'
 
+PLATFORM_ARCH = platform.machine()
+IS_PPC = PLATFORM_ARCH.startswith('ppc')
+
 
 if six.PY3:
     def ntob(n, encoding='ISO-8859-1'):
diff --git a/cheroot/server.py b/cheroot/server.py
index d3512254..f4757b12 100644
--- a/cheroot/server.py
+++ b/cheroot/server.py
@@ -86,6 +86,7 @@ from six.moves import urllib
 
 from . import errors, __version__
 from ._compat import bton, ntou
+from ._compat import IS_PPC
 from .workers import threadpool
 from .makefile import MakeFile, StreamWriter
 
@@ -142,7 +143,7 @@ if not hasattr(socket, 'SO_PEERCRED'):
     which case the getsockopt() will hopefully fail. The arch
     specific value could be derived from platform.processor()
     """
-    socket.SO_PEERCRED = 17
+    socket.SO_PEERCRED = 21 if IS_PPC else 17
 
 
 LF = b'\n'
-- 
2.23.0

openSUSE Build Service is sponsored by