aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/cryptography/_cffi_src/utils.py
diff options
context:
space:
mode:
authortorkve <torkve@yandex-team.ru>2022-02-10 16:48:23 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:48:23 +0300
commitf9cfbeee51d5849127bb58793a2edcdfd7bb91bb (patch)
treef7c863cfcc3f1cb6de7f77e11fec2ae60868c8fb /contrib/python/cryptography/_cffi_src/utils.py
parent5eefa17021221fd267f1dd5f9d63d2493d131a8a (diff)
downloadydb-f9cfbeee51d5849127bb58793a2edcdfd7bb91bb.tar.gz
Restoring authorship annotation for <torkve@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/python/cryptography/_cffi_src/utils.py')
-rw-r--r--contrib/python/cryptography/_cffi_src/utils.py72
1 files changed, 36 insertions, 36 deletions
diff --git a/contrib/python/cryptography/_cffi_src/utils.py b/contrib/python/cryptography/_cffi_src/utils.py
index 56745a3e5b..3682879e6b 100644
--- a/contrib/python/cryptography/_cffi_src/utils.py
+++ b/contrib/python/cryptography/_cffi_src/utils.py
@@ -4,7 +4,7 @@
from __future__ import absolute_import, division, print_function
-import os
+import os
import sys
from distutils.ccompiler import new_compiler
from distutils.dist import Distribution
@@ -12,27 +12,27 @@ from distutils.dist import Distribution
from cffi import FFI
-# Load the cryptography __about__ to get the current package version
-base_src = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
-about = {}
-with open(os.path.join(base_src, "cryptography", "__about__.py")) as f:
- exec (f.read(), about)
-
-
-def build_ffi_for_binding(
- module_name,
- module_prefix,
- modules,
- libraries=[],
- extra_compile_args=[],
- extra_link_args=[],
-):
+# Load the cryptography __about__ to get the current package version
+base_src = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+about = {}
+with open(os.path.join(base_src, "cryptography", "__about__.py")) as f:
+ exec (f.read(), about)
+
+
+def build_ffi_for_binding(
+ module_name,
+ module_prefix,
+ modules,
+ libraries=[],
+ extra_compile_args=[],
+ extra_link_args=[],
+):
"""
Modules listed in ``modules`` should have the following attributes:
* ``INCLUDES``: A string containing C includes.
* ``TYPES``: A string containing C declarations for types.
- * ``FUNCTIONS``: A string containing C declarations for functions & macros.
+ * ``FUNCTIONS``: A string containing C declarations for functions & macros.
* ``CUSTOMIZATIONS``: A string containing arbitrary top-level C code, this
can be used to do things like test for a define and provide an
alternate implementation based on that.
@@ -50,10 +50,10 @@ def build_ffi_for_binding(
includes.append(module.INCLUDES)
customizations.append(module.CUSTOMIZATIONS)
- verify_source = "\n".join(includes + customizations)
+ verify_source = "\n".join(includes + customizations)
ffi = build_ffi(
module_name,
- cdef_source="\n".join(types + functions),
+ cdef_source="\n".join(types + functions),
verify_source=verify_source,
libraries=libraries,
extra_compile_args=extra_compile_args,
@@ -63,20 +63,20 @@ def build_ffi_for_binding(
return ffi
-def build_ffi(
- module_name,
- cdef_source,
- verify_source,
- libraries=[],
- extra_compile_args=[],
- extra_link_args=[],
-):
+def build_ffi(
+ module_name,
+ cdef_source,
+ verify_source,
+ libraries=[],
+ extra_compile_args=[],
+ extra_link_args=[],
+):
ffi = FFI()
- # Always add the CRYPTOGRAPHY_PACKAGE_VERSION to the shared object
- cdef_source += "\nstatic const char *const CRYPTOGRAPHY_PACKAGE_VERSION;"
- verify_source += '\n#define CRYPTOGRAPHY_PACKAGE_VERSION "{}"'.format(
- about["__version__"]
- )
+ # Always add the CRYPTOGRAPHY_PACKAGE_VERSION to the shared object
+ cdef_source += "\nstatic const char *const CRYPTOGRAPHY_PACKAGE_VERSION;"
+ verify_source += '\n#define CRYPTOGRAPHY_PACKAGE_VERSION "{}"'.format(
+ about["__version__"]
+ )
ffi.cdef(cdef_source)
ffi.set_source(
module_name,
@@ -89,10 +89,10 @@ def build_ffi(
def extra_link_args(compiler_type):
- if compiler_type == "msvc":
+ if compiler_type == "msvc":
# Enable NX and ASLR for Windows builds on MSVC. These are enabled by
# default on Python 3.3+ but not on 2.x.
- return ["/NXCOMPAT", "/DYNAMICBASE"]
+ return ["/NXCOMPAT", "/DYNAMICBASE"]
else:
return []
@@ -100,11 +100,11 @@ def extra_link_args(compiler_type):
def compiler_type():
"""
Gets the compiler type from distutils. On Windows with MSVC it will be
- "msvc". On macOS and linux it is "unix".
+ "msvc". On macOS and linux it is "unix".
"""
dist = Distribution()
dist.parse_config_files()
- cmd = dist.get_command_obj("build")
+ cmd = dist.get_command_obj("build")
cmd.ensure_finalized()
compiler = new_compiler(compiler=cmd.compiler)
return compiler.compiler_type