Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
def test_c_version():
parent = os.path.dirname(os.path.dirname(cffi.__file__))
v = cffi.__version__
p = os.path.join(parent, 'c', 'test_c.py')
content = open(p).read()
#v = BACKEND_VERSIONS.get(v, v)
assert (('assert __version__ == "%s"' % v) in content)
def test_egg_version():
info = Parser().parsestr(egg_info.read())
assert info['version'] == cffi.__version__
import re
from setuptools import setup, Extension
# CFFI is needed to call setup() and therefore it needs to be installed before
# this setup script can be run.
try:
import cffi
except ImportError:
sys.stderr.write('Error: CFFI (required for setup) is not available.\n')
sys.stderr.write('Please use "pip install cffi", or equivalent.\n')
sys.exit(1)
re_int = re.compile('^(\d*).*$')
cffi_ver = tuple((int(re_int.sub('0\\1', x)) for x in cffi.__version__.split('.')))
if cffi_ver < (0, 8):
sys.stderr.write('Error: CFFI (required for setup) is too old.\n')
sys.stderr.write('Please install at least version 0.8.\n')
sys.exit(1)
version_info = {
'name': 'bluepass',
'version': '0.9.0.dev',
'description': 'The Bluepass password manager.',
'author': 'Geert Jansen',
'author_email': 'geertj@gmail.com',
'url': 'http://github.com/geertj/bluepass',
'license': 'GPLv3',
'classifiers': [
'Development Status :: 3 - Alpha',
import sys
import cffi
import mmap
import re
from libmarpa import ffi, lib
import libmarpa_codes as codes
ver = ffi.new("int [3]")
lib.marpa_version(ver)
uname = os.uname()
print "os:", uname[0], uname[2], uname[3], uname[4]
print "python version:", '.'.join(map(str, sys.version_info[0:3]))
print "libmarpa version:", '.'.join(map(str, ver))
print "cffi version:", cffi.__version__
print "-" * 19
config = ffi.new("Marpa_Config*")
lib.marpa_c_init(config)
def fail(s, g):
e = lib.marpa_g_error(g, ffi.new("char**"))
assert e == lib.MARPA_ERR_NONE, s + ': ' + codes.errors[e]
g = ffi.gc(lib.marpa_g_new(config), lib.marpa_g_unref)
msg = ffi.new("char **")
assert lib.marpa_c_error(config, msg) == lib.MARPA_ERR_NONE, msg
# grammar symbols from RFC 7159
S_begin_array = lib.marpa_g_symbol_new (g)
assert S_begin_array >= 0, fail ("marpa_g_symbol_new", g)
def __init__(self, parent, read_timeout, server_address):
self.connected = False
self.read_timeout = read_timeout
self.parent = parent
global vpp_object
vpp_object = parent
# Register error handler
vpp_api.vac_set_error_handler(vac_error_handler)
# Support legacy CFFI
# from_buffer supported from 1.8.0
(major, minor, patch) = [int(s) for s in
cffi.__version__.split('.', 3)]
if major >= 1 and minor >= 8:
self.write = self._write_new_cffi
else:
self.write = self._write_legacy_cffi
from __future__ import unicode_literals
from distutils.version import StrictVersion
import cffi
import os
__version__ = '0.3.1'
if StrictVersion(cffi.__version__) < StrictVersion('0.7'):
raise RuntimeError(
'bt_manager requires cffi >= 0.7, but found %s' % cffi.__version__)
ffi = cffi.FFI()
cwd = os.path.dirname(__file__)
header_file = os.path.join(cwd, 'rtpsbc.h')
with open(header_file) as fh:
header = fh.read()
ffi.cdef(header)
fh.close()
from bt_manager.adapter import BTAdapter # noqa
from bt_manager.agent import BTAgent # noqa
from bt_manager.attributes import ATTRIBUTES # noqa
from bt_manager.audio import BTAudio, BTAudioSource # noqa
from bt_manager.audio import BTAudioSink, SBCAudioCodec # noqa
from bt_manager.audio import SBCAudioSource, SBCAudioSink # noqa
from bt_manager.cod import BTCoD # noqa
from __future__ import unicode_literals
from distutils.version import StrictVersion
import cffi
import os
__version__ = '0.3.1'
if StrictVersion(cffi.__version__) < StrictVersion('0.7'):
raise RuntimeError(
'bt_manager requires cffi >= 0.7, but found %s' % cffi.__version__)
ffi = cffi.FFI()
cwd = os.path.dirname(__file__)
header_file = os.path.join(cwd, 'rtpsbc.h')
with open(header_file) as fh:
header = fh.read()
ffi.cdef(header)
fh.close()
from bt_manager.adapter import BTAdapter # noqa
from bt_manager.agent import BTAgent # noqa
from bt_manager.attributes import ATTRIBUTES # noqa
from bt_manager.audio import BTAudio, BTAudioSource # noqa
from bt_manager.audio import BTAudioSink, SBCAudioCodec # noqa
f
for f in action.attrlist("fmri")
if "/cffi-" in pkg.fmri.PkgFmri(f, "5.12").pkg_name):
continue
if action.attrs["type"] in ("require", "require-any"):
cffi_require = action
elif action.attrs["type"] == "incorporate":
cffi_incorp = action
try:
sys.path[0:0] = [os.path.join(os.getenv("WS_TOP", ""),
"components/python/cffi/build/prototype/"
"%s/usr/lib/python%d.%d/vendor-packages" %
((platform.processor(),) + sys.version_info[:2]))]
import cffi
cffi_version = cffi.__version__
del sys.path[0]
except ImportError:
cffi_version = None
if not cffi_require:
return
if not cffi_version:
engine.warning(_("package %s depends on CFFI, but we "
"cannot determine the version of CFFI needed") %
manifest.fmri,
msgid="%s%s.1" % (self.name, pkglint_id))
if not cffi_incorp:
engine.error(_("package %(pkg)s depends on CFFI, but "
"does not incorporate it (should be at %(should)s)")
cryptography's linked OpenSSL: {crypto_openssl_link}
Pythons's OpenSSL: {python_openssl}
Python executable: {python}
Python version: {python_version}
Platform: {platform}
sys.path: {sys_path}""".format(
pyopenssl=version.__version__,
crypto_openssl_compile=OpenSSL._util.ffi.string(
OpenSSL._util.lib.OPENSSL_VERSION_TEXT,
).decode("ascii"),
crypto_openssl_link=OpenSSL.SSL.SSLeay_version(
OpenSSL.SSL.SSLEAY_VERSION
).decode("ascii"),
python_openssl=getattr(ssl, "OPENSSL_VERSION", "n/a"),
cryptography=cryptography.__version__,
cffi=cffi.__version__,
python=sys.executable,
python_version=sys.version,
platform=sys.platform,
sys_path=sys.path,
)
if __name__ == "__main__":
print(_env_info)