[pypy-commit] pypy py3.5: minimum fix to allow import _ssl, build_cffi_imports to run on win32
mattip
pypy.commits at gmail.com
Mon Dec 18 15:08:19 EST 2017
Author: Matti Picus <matti.picus at gmail.com>
Branch: py3.5
Changeset: r93478:1c2e6a98c3e0
Date: 2017-12-18 22:07 +0200
http://bitbucket.org/pypy/pypy/changeset/1c2e6a98c3e0/
Log: minimum fix to allow import _ssl, build_cffi_imports to run on win32
diff --git a/lib_pypy/_cffi_ssl/_stdssl/__init__.py b/lib_pypy/_cffi_ssl/_stdssl/__init__.py
--- a/lib_pypy/_cffi_ssl/_stdssl/__init__.py
+++ b/lib_pypy/_cffi_ssl/_stdssl/__init__.py
@@ -20,9 +20,14 @@
SSL_ERROR_EOF, SSL_ERROR_NO_SOCKET, SSL_ERROR_INVALID_ERROR_CODE,
pyerr_write_unraisable)
from _cffi_ssl._stdssl import error
-from select import poll, POLLIN, POLLOUT, select
+from select import select
from enum import IntEnum as _IntEnum
+if sys.platform == 'win32':
+ HAVE_POLL = False
+else:
+ from select import poll, POLLIN, POLLOUT
+
OPENSSL_VERSION = ffi.string(lib.OPENSSL_VERSION_TEXT).decode('utf-8')
OPENSSL_VERSION_NUMBER = lib.OPENSSL_VERSION_NUMBER
ver = OPENSSL_VERSION_NUMBER
@@ -158,8 +163,6 @@
def _monotonic_clock():
return time.clock_gettime(time.CLOCK_MONOTONIC)
-HAVE_POLL = True
-
def _ssl_select(sock, writing, timeout):
if HAVE_POLL:
p = poll()
diff --git a/pypy/tool/build_cffi_imports.py b/pypy/tool/build_cffi_imports.py
--- a/pypy/tool/build_cffi_imports.py
+++ b/pypy/tool/build_cffi_imports.py
@@ -17,8 +17,8 @@
"resource": "_resource_build.py" if sys.platform != "win32" else None,
"lzma": "_lzma_build.py",
"_decimal": "_decimal_build.py",
- "ssl": "_ssl_build.py",
- # hashlib does not need to be built! It uses API calls from ssl
+ "_ssl": "_ssl_build.py",
+ # hashlib does not need to be built! It uses API calls from _ssl
"xx": None, # for testing: 'None' should be completely ignored
}
@@ -28,7 +28,7 @@
'lzma': ('https://tukaani.org/xz/xz-5.2.3.tar.gz',
'71928b357d0a09a12a4b4c5fafca8c31c19b0e7d3b8ebb19622e96f26dbf28cb',
[]),
- 'ssl': ('http://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-2.6.2.tar.gz',
+ '_ssl': ('http://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-2.6.2.tar.gz',
'b029d2492b72a9ba5b5fcd9f3d602c9fd0baa087912f2aaecc28f52f567ec478',
['--without-openssldir']),
'_gdbm': ('http://ftp.gnu.org/gnu/gdbm/gdbm-1.13.tar.gz',
@@ -159,6 +159,12 @@
continue
if module is None or getattr(options, 'no_' + key, False):
continue
+ # the key is the module name, has it already been built?
+ status, stdout, stderr = run_subprocess(str(pypy_c), ['-c', 'import %s' % key])
+ if status == 0:
+ print('*', ' %s already built' % key, file=sys.stderr)
+ continue
+
if module.endswith('.py'):
args = [module]
cwd = str(join(basedir,'lib_pypy'))
@@ -175,7 +181,7 @@
shutil.rmtree(destdir, ignore_errors=True)
os.makedirs(destdir)
- if key == 'ssl' and sys.platform == 'darwin':
+ if key == '_ssl' and sys.platform == 'darwin':
# this patch is loosely inspired by an Apple and adds
# a fallback to the OS X roots when none are available
patches = [
@@ -201,7 +207,7 @@
env['LDFLAGS'] = \
'-L{}/usr/lib {}'.format(destdir, env.get('LDFLAGS', ''))
- if key == 'ssl' and sys.platform == 'darwin':
+ if key == '_ssl' and sys.platform == 'darwin':
# needed for our roots patch
env['LDFLAGS'] += ' -framework CoreFoundation -framework Security'
@@ -237,7 +243,7 @@
help='instead of executing sys.executable' \
' you can specify an alternative pypy vm here')
parser.add_argument('--only', dest='only', default=None,
- help='Only build the modules delimited by a colon. E.g. ssl,sqlite')
+ help='Only build the modules delimited by a colon. E.g. _ssl,sqlite')
parser.add_argument('--embed-dependencies', dest='embed_dependencies', action='store_true',
help='embed dependencies for distribution')
args = parser.parse_args()
More information about the pypy-commit
mailing list