Include local versions of third-party dependencies, particularly those unavailable or outdated as OS packages.

This commit is contained in:
Chris Church
2013-06-23 21:04:55 -04:00
parent c2a0004c6c
commit cbd64ee65d
1516 changed files with 161293 additions and 110 deletions

View File

@@ -0,0 +1,48 @@
from __future__ import absolute_import
import errno
import os
import sys
import __builtin__
if sys.version_info[0] == 3:
bytes = bytes
else:
try:
_bytes = __builtin__.bytes
except AttributeError:
_bytes = str
class bytes(_bytes): # noqa
def __new__(cls, *args):
if len(args) > 1:
return _bytes(args[0]).encode(*args[1:])
return _bytes(*args)
try:
closerange = os.closerange
except AttributeError:
def closerange(fd_low, fd_high): # noqa
for fd in reversed(xrange(fd_low, fd_high)):
try:
os.close(fd)
except OSError, exc:
if exc.errno != errno.EBADF:
raise
def get_errno(exc):
""":exc:`socket.error` and :exc:`IOError` first got
the ``.errno`` attribute in Py2.7"""
try:
return exc.errno
except AttributeError:
try:
# e.args = (errno, reason)
if isinstance(exc.args, tuple) and len(exc.args) == 2:
return exc.args[0]
except AttributeError:
pass
return 0