當前位置: 首頁>>代碼示例>>Python>>正文


Python _cffi_backend.__version__方法代碼示例

本文整理匯總了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__ 
開發者ID:johncsnyder,項目名稱:SwiftKitten,代碼行數:10,代碼來源:test_version.py

示例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 
開發者ID:johncsnyder,項目名稱:SwiftKitten,代碼行數:10,代碼來源:test_version.py

示例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 
開發者ID:johncsnyder,項目名稱:SwiftKitten,代碼行數:8,代碼來源:test_version.py

示例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 
開發者ID:johncsnyder,項目名稱:SwiftKitten,代碼行數:9,代碼來源:test_version.py

示例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 
開發者ID:johncsnyder,項目名稱:SwiftKitten,代碼行數:8,代碼來源:test_version.py

示例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 
開發者ID:reBiocoder,項目名稱:bioforum,代碼行數:61,代碼來源:api.py

示例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() 
開發者ID:aliyun,項目名稱:oss-ftp,代碼行數:49,代碼來源:api.py

示例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() 
開發者ID:proxysh,項目名稱:Safejumper-for-Desktop,代碼行數:50,代碼來源:api.py


注:本文中的_cffi_backend.__version__方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。