Last active
February 28, 2017 16:27
-
-
Save malexandre/d7d89ef69be325e15eb54fe3aecb45bd to your computer and use it in GitHub Desktop.
Update google/appengine/dist27/socket.py as per https://code.google.com/p/googleappengine/issues/detail?id=12783
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
content = '' | |
with open('/google-cloud-sdk/platform/google_appengine/google/appengine/dist27/socket.py', 'rb') as fd: | |
content = fd.read() | |
content = content.replace('from _ssl import RAND_add, RAND_egd, RAND_status, SSL_ERROR_ZERO_RETURN, SSL_ERROR_WANT_READ, SSL_ERROR_WANT_WRITE, SSL_ERROR_WANT_X509_LOOKUP, SSL_ERROR_SYSCALL, SSL_ERROR_SSL, SSL_ERROR_WANT_CONNECT, SSL_ERROR_EOF, SSL_ERROR_INVALID_ERROR_CODE', | |
'''from _ssl import \\ | |
RAND_add, \\ | |
RAND_status, \\ | |
SSL_ERROR_ZERO_RETURN, \\ | |
SSL_ERROR_WANT_READ, \\ | |
SSL_ERROR_WANT_WRITE, \\ | |
SSL_ERROR_WANT_X509_LOOKUP, \\ | |
SSL_ERROR_SYSCALL, \\ | |
SSL_ERROR_SSL, \\ | |
SSL_ERROR_WANT_CONNECT, \\ | |
SSL_ERROR_EOF, \\ | |
SSL_ERROR_INVALID_ERROR_CODE | |
# GOOGLE NOTE: | |
# RAND_egd is not available on some platforms (Windows, etc.) | |
# See python issue 21356 (https://bugs.python.org/issue21356) | |
try: | |
from _ssl import RAND_egd | |
except ImportError: | |
pass | |
''') | |
content = content.replace('if sys.platform.lower().startswith("win"):', "if os.name == 'nt':") | |
with open('/google-cloud-sdk/platform/google_appengine/google/appengine/dist27/socket.py', 'wb') as fd: | |
fd.write(content) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment