mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Catch ctypes import errors.
This commit is contained in:
parent
b7adfe2628
commit
4f96ccedc1
@ -3,16 +3,22 @@
|
|||||||
# This file is part of gunicorn released under the MIT license.
|
# This file is part of gunicorn released under the MIT license.
|
||||||
# See the NOTICE for more information.
|
# See the NOTICE for more information.
|
||||||
|
|
||||||
import ctypes
|
|
||||||
import ctypes.util
|
|
||||||
import errno
|
import errno
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
if sys.version_info >= (2, 6):
|
# Python on Solaris compiled with Sun Studio doesn't have ctypes.
|
||||||
_libc = ctypes.CDLL(ctypes.util.find_library("c"), use_errno=True)
|
try:
|
||||||
_sendfile = _libc.sendfile
|
import ctypes
|
||||||
else:
|
import ctypes.util
|
||||||
|
|
||||||
|
if sys.version_info >= (2, 6):
|
||||||
|
_libc = ctypes.CDLL(ctypes.util.find_library("c"), use_errno=True)
|
||||||
|
_sendfile = _libc.sendfile
|
||||||
|
else:
|
||||||
|
_sendfile = None
|
||||||
|
|
||||||
|
except ImportError:
|
||||||
_sendfile = None
|
_sendfile = None
|
||||||
|
|
||||||
if _sendfile:
|
if _sendfile:
|
||||||
|
|||||||
@ -10,6 +10,9 @@ except MemoryError:
|
|||||||
# selinux execmem denial
|
# selinux execmem denial
|
||||||
# https://bugzilla.redhat.com/show_bug.cgi?id=488396
|
# https://bugzilla.redhat.com/show_bug.cgi?id=488396
|
||||||
ctypes = None
|
ctypes = None
|
||||||
|
except ImportError:
|
||||||
|
# Python on Solaris compiled with Sun Studio doesn't have ctypes
|
||||||
|
ctypes = None
|
||||||
|
|
||||||
import fcntl
|
import fcntl
|
||||||
import os
|
import os
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user