本文整理汇总了Python中_cffi_backend.__version__方法的典型用法代码示例。如果您正苦于以下问题:Python _cffi_backend.__version__方法的具体用法?Python _cffi_backend.__version__怎么用?Python _cffi_backend.__version__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类_cffi_backend
的用法示例。
在下文中一共展示了_cffi_backend.__version__方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_version
# 需要导入模块: import _cffi_backend [as 别名]
# 或者: from _cffi_backend import __version__ [as 别名]
def test_version():
v = cffi.__version__
version_info = '.'.join(str(i) for i in cffi.__version_info__)
version_info = version_info.replace('.beta.', 'b')
version_info = version_info.replace('.plus', '+')
assert v == version_info
#v = BACKEND_VERSIONS.get(v, v)
assert v == _cffi_backend.__version__
示例2: test_doc_version
# 需要导入模块: import _cffi_backend [as 别名]
# 或者: from _cffi_backend import __version__ [as 别名]
def test_doc_version():
parent = os.path.dirname(os.path.dirname(cffi.__file__))
p = os.path.join(parent, 'doc', 'source', 'conf.py')
content = open(p).read()
#
v = cffi.__version__
assert ("version = '%s'\n" % v[:3]) in content
assert ("release = '%s'\n" % v) in content
示例3: test_doc_version_file
# 需要导入模块: import _cffi_backend [as 别名]
# 或者: from _cffi_backend import __version__ [as 别名]
def test_doc_version_file():
parent = os.path.dirname(os.path.dirname(cffi.__file__))
v = cffi.__version__.replace('+', '')
p = os.path.join(parent, 'doc', 'source', 'installation.rst')
content = open(p).read()
assert ("cffi/cffi-%s.tar.gz" % v) in content
示例4: test_setup_version
# 需要导入模块: import _cffi_backend [as 别名]
# 或者: from _cffi_backend import __version__ [as 别名]
def test_setup_version():
parent = os.path.dirname(os.path.dirname(cffi.__file__))
p = os.path.join(parent, 'setup.py')
content = open(p).read()
#
v = cffi.__version__.replace('+', '')
assert ("version='%s'" % v) in content
示例5: test_embedding_h
# 需要导入模块: import _cffi_backend [as 别名]
# 或者: from _cffi_backend import __version__ [as 别名]
def test_embedding_h():
parent = os.path.dirname(os.path.dirname(cffi.__file__))
v = cffi.__version__
p = os.path.join(parent, 'cffi', '_embedding.h')
content = open(p).read()
assert ('cffi version: %s"' % (v,)) in content
示例6: __init__
# 需要导入模块: import _cffi_backend [as 别名]
# 或者: from _cffi_backend import __version__ [as 别名]
def __init__(self, backend=None):
"""Create an FFI instance. The 'backend' argument is used to
select a non-default backend, mostly for tests.
"""
if backend is None:
# You need PyPy (>= 2.0 beta), or a CPython (>= 2.6) with
# _cffi_backend.so compiled.
import _cffi_backend as backend
from . import __version__
if backend.__version__ != __version__:
# bad version! Try to be as explicit as possible.
if hasattr(backend, '__file__'):
# CPython
raise Exception("Version mismatch: this is the 'cffi' package version %s, located in %r. When we import the top-level '_cffi_backend' extension module, we get version %s, located in %r. The two versions should be equal; check your installation." % (
__version__, __file__,
backend.__version__, backend.__file__))
else:
# PyPy
raise Exception("Version mismatch: this is the 'cffi' package version %s, located in %r. This interpreter comes with a built-in '_cffi_backend' module, which is version %s. The two versions should be equal; check your installation." % (
__version__, __file__, backend.__version__))
# (If you insist you can also try to pass the option
# 'backend=backend_ctypes.CTypesBackend()', but don't
# rely on it! It's probably not going to work well.)
from . import cparser
self._backend = backend
self._lock = allocate_lock()
self._parser = cparser.Parser()
self._cached_btypes = {}
self._parsed_types = types.ModuleType('parsed_types').__dict__
self._new_types = types.ModuleType('new_types').__dict__
self._function_caches = []
self._libraries = []
self._cdefsources = []
self._included_ffis = []
self._windows_unicode = None
self._init_once_cache = {}
self._cdef_version = None
self._embedding = None
self._typecache = model.get_typecache(backend)
if hasattr(backend, 'set_ffi'):
backend.set_ffi(self)
for name in list(backend.__dict__):
if name.startswith('RTLD_'):
setattr(self, name, getattr(backend, name))
#
with self._lock:
self.BVoidP = self._get_cached_btype(model.voidp_type)
self.BCharA = self._get_cached_btype(model.char_array_type)
if isinstance(backend, types.ModuleType):
# _cffi_backend: attach these constants to the class
if not hasattr(FFI, 'NULL'):
FFI.NULL = self.cast(self.BVoidP, 0)
FFI.CData, FFI.CType = backend._get_types()
else:
# ctypes backend: attach these constants to the instance
self.NULL = self.cast(self.BVoidP, 0)
self.CData, self.CType = backend._get_types()
self.buffer = backend.buffer
示例7: __init__
# 需要导入模块: import _cffi_backend [as 别名]
# 或者: from _cffi_backend import __version__ [as 别名]
def __init__(self, backend=None):
"""Create an FFI instance. The 'backend' argument is used to
select a non-default backend, mostly for tests.
"""
from . import cparser, model
if backend is None:
# You need PyPy (>= 2.0 beta), or a CPython (>= 2.6) with
# _cffi_backend.so compiled.
import _cffi_backend as backend
from . import __version__
assert backend.__version__ == __version__, \
"version mismatch, %s != %s" % (backend.__version__, __version__)
# (If you insist you can also try to pass the option
# 'backend=backend_ctypes.CTypesBackend()', but don't
# rely on it! It's probably not going to work well.)
self._backend = backend
self._lock = allocate_lock()
self._parser = cparser.Parser()
self._cached_btypes = {}
self._parsed_types = types.ModuleType('parsed_types').__dict__
self._new_types = types.ModuleType('new_types').__dict__
self._function_caches = []
self._libraries = []
self._cdefsources = []
self._included_ffis = []
self._windows_unicode = None
self._init_once_cache = {}
self._cdef_version = None
if hasattr(backend, 'set_ffi'):
backend.set_ffi(self)
for name in backend.__dict__:
if name.startswith('RTLD_'):
setattr(self, name, getattr(backend, name))
#
with self._lock:
self.BVoidP = self._get_cached_btype(model.voidp_type)
self.BCharA = self._get_cached_btype(model.char_array_type)
if isinstance(backend, types.ModuleType):
# _cffi_backend: attach these constants to the class
if not hasattr(FFI, 'NULL'):
FFI.NULL = self.cast(self.BVoidP, 0)
FFI.CData, FFI.CType = backend._get_types()
else:
# ctypes backend: attach these constants to the instance
self.NULL = self.cast(self.BVoidP, 0)
self.CData, self.CType = backend._get_types()
示例8: __init__
# 需要导入模块: import _cffi_backend [as 别名]
# 或者: from _cffi_backend import __version__ [as 别名]
def __init__(self, backend=None):
"""Create an FFI instance. The 'backend' argument is used to
select a non-default backend, mostly for tests.
"""
from . import cparser, model
if backend is None:
# You need PyPy (>= 2.0 beta), or a CPython (>= 2.6) with
# _cffi_backend.so compiled.
import _cffi_backend as backend
from . import __version__
assert backend.__version__ == __version__, \
"version mismatch, %s != %s" % (backend.__version__, __version__)
# (If you insist you can also try to pass the option
# 'backend=backend_ctypes.CTypesBackend()', but don't
# rely on it! It's probably not going to work well.)
self._backend = backend
self._lock = allocate_lock()
self._parser = cparser.Parser()
self._cached_btypes = {}
self._parsed_types = types.ModuleType('parsed_types').__dict__
self._new_types = types.ModuleType('new_types').__dict__
self._function_caches = []
self._libraries = []
self._cdefsources = []
self._included_ffis = []
self._windows_unicode = None
self._init_once_cache = {}
self._cdef_version = None
self._embedding = None
if hasattr(backend, 'set_ffi'):
backend.set_ffi(self)
for name in backend.__dict__:
if name.startswith('RTLD_'):
setattr(self, name, getattr(backend, name))
#
with self._lock:
self.BVoidP = self._get_cached_btype(model.voidp_type)
self.BCharA = self._get_cached_btype(model.char_array_type)
if isinstance(backend, types.ModuleType):
# _cffi_backend: attach these constants to the class
if not hasattr(FFI, 'NULL'):
FFI.NULL = self.cast(self.BVoidP, 0)
FFI.CData, FFI.CType = backend._get_types()
else:
# ctypes backend: attach these constants to the instance
self.NULL = self.cast(self.BVoidP, 0)
self.CData, self.CType = backend._get_types()