Debian Codegraph @

lib_pypy/_ssl_build.py

raw symbols SCIP
1 import os
2 import sys
3 from _cffi_ssl import _cffi_src
4 sys.modules['_cffi_src'] = _cffi_src
5 #
6 from _cffi_ssl._cffi_src.build_openssl import (build_ffi_for_binding,
7 _get_openssl_libraries, extra_link_args, compiler_type)
8
9 if sys.platform == "win32":
10 pypy_win32_extra = ["pypy_win32_extra"]
11 else:
12 pypy_win32_extra = []
13
14 libraries=_get_openssl_libraries(sys.platform)
15 ffi = build_ffi_for_binding(
16 module_name="_pypy_openssl",
17 module_prefix="_cffi_src.openssl.",
18 modules=[
19 # This goes first so we can define some cryptography-wide symbols.
20 "cryptography",
21
22 # Provider comes early as well so we define OSSL_LIB_CTX
23 "provider",
24 "asn1",
25 "bignum",
26 "bio",
27 "cmac",
28 "crypto",
29 "ct",
30 "dh",
31 "dsa",
32 "ec",
33 "ecdh",
34 "ecdsa",
35 "engine",
36 "err",
37 "evp",
38 "fips",
39 "hmac",
40 "nid",
41 "objects",
42 "ocsp",
43 "opensslv",
44 "pem",
45 "pkcs12",
46 "rand",
47 "rsa",
48 "ssl",
49 "x509",
50 "x509name",
51 "x509v3",
52 "x509_vfy",
53 "pkcs7",
54 "callbacks",
55 ] + pypy_win32_extra,
56 libraries=libraries,
57 extra_link_args=extra_link_args(compiler_type()),
58 )
59
60 if __name__ == '__main__':
61 ffi.compile(verbose=True)
62 if sys.platform == 'win32' and "PYPY_PACKAGE_NO_DLLS" not in os.environ:
63 # copy dlls from externals to the pwd
64 # maybe we should link to libraries instead of the dlls
65 # to avoid this mess
66 import os, glob, shutil
67 path_parts = os.environ['PATH'].split(';')
68 candidates = [x for x in path_parts if 'externals' in x]
69
70 def copy_from_path(dll):
71 for c in candidates:
72 files = glob.glob(os.path.join(c, dll + '*.dll'))
73 if files:
74 for fname in files:
75 print('copying', fname)
76 shutil.copy(fname, '.')
77 break
78 else:
79 print("not copying %s from %s", (dll, c))
80
81 if candidates:
82 for lib in libraries:
83 copy_from_path(lib)
84 else:
85 print('no "externals" on PATH, not copying %s, expect trouble', libraries)