diff options
author | torkve <torkve@yandex-team.ru> | 2022-02-10 16:48:23 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:23 +0300 |
commit | f9cfbeee51d5849127bb58793a2edcdfd7bb91bb (patch) | |
tree | f7c863cfcc3f1cb6de7f77e11fec2ae60868c8fb /contrib/python/cryptography/_cffi_src/build_openssl.py | |
parent | 5eefa17021221fd267f1dd5f9d63d2493d131a8a (diff) | |
download | ydb-f9cfbeee51d5849127bb58793a2edcdfd7bb91bb.tar.gz |
Restoring authorship annotation for <torkve@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/python/cryptography/_cffi_src/build_openssl.py')
-rw-r--r-- | contrib/python/cryptography/_cffi_src/build_openssl.py | 112 |
1 files changed, 56 insertions, 56 deletions
diff --git a/contrib/python/cryptography/_cffi_src/build_openssl.py b/contrib/python/cryptography/_cffi_src/build_openssl.py index 4380c33969..ea26b01ce8 100644 --- a/contrib/python/cryptography/_cffi_src/build_openssl.py +++ b/contrib/python/cryptography/_cffi_src/build_openssl.py @@ -6,71 +6,71 @@ from __future__ import absolute_import, division, print_function import os import sys -from distutils import dist -from distutils.ccompiler import get_default_compiler -from distutils.command.config import config +from distutils import dist +from distutils.ccompiler import get_default_compiler +from distutils.command.config import config from _cffi_src.utils import ( - build_ffi_for_binding, - compiler_type, - extra_link_args, + build_ffi_for_binding, + compiler_type, + extra_link_args, ) def _get_openssl_libraries(platform): - if os.environ.get("CRYPTOGRAPHY_SUPPRESS_LINK_FLAGS", None): - return [] + if os.environ.get("CRYPTOGRAPHY_SUPPRESS_LINK_FLAGS", None): + return [] # OpenSSL goes by a different library name on different operating systems. - if platform == "win32" and compiler_type() == "msvc": - return [ - "libssl", - "libcrypto", - "advapi32", - "crypt32", - "gdi32", - "user32", - "ws2_32", - ] + if platform == "win32" and compiler_type() == "msvc": + return [ + "libssl", + "libcrypto", + "advapi32", + "crypt32", + "gdi32", + "user32", + "ws2_32", + ] else: - # darwin, linux, mingw all use this path + # darwin, linux, mingw all use this path # In some circumstances, the order in which these libs are # specified on the linker command-line is significant; # libssl must come before libcrypto - # (https://marc.info/?l=openssl-users&m=135361825921871) - # -lpthread required due to usage of pthread an potential - # existance of a static part containing e.g. pthread_atfork - # (https://github.com/pyca/cryptography/issues/5084) - if sys.platform == "zos": - return ["ssl", "crypto"] - else: - return ["ssl", "crypto", "pthread"] + # (https://marc.info/?l=openssl-users&m=135361825921871) + # -lpthread required due to usage of pthread an potential + # existance of a static part containing e.g. pthread_atfork + # (https://github.com/pyca/cryptography/issues/5084) + if sys.platform == "zos": + return ["ssl", "crypto"] + else: + return ["ssl", "crypto", "pthread"] -def _extra_compile_args(platform): - """ - We set -Wconversion args here so that we only do Wconversion checks on the - code we're compiling and not on cffi itself (as passing -Wconversion in - CFLAGS would do). We set no error on sign conversion because some - function signatures in LibreSSL differ from OpenSSL have changed on long - vs. unsigned long in the past. Since that isn't a precision issue we don't - care. - """ - # make sure the compiler used supports the flags to be added - is_gcc = False - if get_default_compiler() == "unix": - d = dist.Distribution() - cmd = config(d) - cmd._check_compiler() - is_gcc = ( - "gcc" in cmd.compiler.compiler[0] - or "clang" in cmd.compiler.compiler[0] - ) - if is_gcc or not ( - platform in ["win32", "hp-ux11", "sunos5"] - or platform.startswith("aix") - ): - return ["-Wconversion", "-Wno-error=sign-conversion"] - else: +def _extra_compile_args(platform): + """ + We set -Wconversion args here so that we only do Wconversion checks on the + code we're compiling and not on cffi itself (as passing -Wconversion in + CFLAGS would do). We set no error on sign conversion because some + function signatures in LibreSSL differ from OpenSSL have changed on long + vs. unsigned long in the past. Since that isn't a precision issue we don't + care. + """ + # make sure the compiler used supports the flags to be added + is_gcc = False + if get_default_compiler() == "unix": + d = dist.Distribution() + cmd = config(d) + cmd._check_compiler() + is_gcc = ( + "gcc" in cmd.compiler.compiler[0] + or "clang" in cmd.compiler.compiler[0] + ) + if is_gcc or not ( + platform in ["win32", "hp-ux11", "sunos5"] + or platform.startswith("aix") + ): + return ["-Wconversion", "-Wno-error=sign-conversion"] + else: return [] @@ -87,7 +87,7 @@ ffi = build_ffi_for_binding( "cmac", "conf", "crypto", - "ct", + "ct", "dh", "dsa", "ec", @@ -96,13 +96,13 @@ ffi = build_ffi_for_binding( "engine", "err", "evp", - "fips", + "fips", "hmac", "nid", "objects", "ocsp", "opensslv", - "osrandom_engine", + "osrandom_engine", "pem", "pkcs12", "rand", @@ -116,6 +116,6 @@ ffi = build_ffi_for_binding( "callbacks", ], libraries=_get_openssl_libraries(sys.platform), - extra_compile_args=_extra_compile_args(sys.platform), + extra_compile_args=_extra_compile_args(sys.platform), extra_link_args=extra_link_args(compiler_type()), ) |