示例#1
0
from cffi import FFI

sys.path.append(".")

try:
    import _setuputils
except ImportError:
    print(
        "This file must be imported with setup.py in the current working dir.")
    raise

__all__ = []

WIN = sys.platform.startswith('win32')
LIBUV_EMBED = _setuputils.should_embed('libuv')

ffi = FFI()

thisdir = os.path.dirname(os.path.abspath(__file__))
parentdir = os.path.abspath(os.path.join(thisdir, '..'))
setup_py_dir = os.path.abspath(os.path.join(thisdir, '..', '..', '..'))
libuv_dir = os.path.abspath(os.path.join(setup_py_dir, 'deps', 'libuv'))


def read_source(name):
    with open(os.path.join(thisdir, name), 'r') as f:
        return f.read()


_cdef = read_source('_corecffi_cdef.c')
示例#2
0
import sys
import os.path

from _setuputils import Extension

from _setuputils import system
from _setuputils import quoted_dep_abspath
from _setuputils import WIN
from _setuputils import make_universal_header
from _setuputils import LIBRARIES
from _setuputils import DEFINE_MACROS
from _setuputils import glob_many
from _setuputils import dep_abspath
from _setuputils import should_embed

LIBEV_EMBED = should_embed('libev')

# Configure libev in place; but cp the config.h to the old directory;
# if we're building a CPython extension, the old directory will be
# the build/temp.XXX/libev/ directory. If we're building from a
# source checkout on pypy, OLDPWD will be the location of setup.py
# and the PyPy branch will clean it up.
libev_configure_command = ' '.join([
    "(cd ",
    quoted_dep_abspath('libev'), " && sh ./configure ",
    " && cp config.h \"$OLDPWD\"", ")", '> configure-output.txt'
])


def configure_libev(bext, ext):
    if WIN:
示例#3
0
import distutils.sysconfig  # to get CFLAGS to pass into c-ares configure script pylint:disable=import-error

from _setuputils import WIN
from _setuputils import quoted_dep_abspath
from _setuputils import system
from _setuputils import should_embed
from _setuputils import LIBRARIES
from _setuputils import DEFINE_MACROS
from _setuputils import glob_many
from _setuputils import dep_abspath
from _setuputils import RUNNING_ON_CI
from _setuputils import RUNNING_FROM_CHECKOUT
from _setuputils import cythonize1
from _setuputils import get_include_dirs

CARES_EMBED = should_embed('c-ares')

# See #616, trouble building for a 32-bit python on a 64-bit platform
# (Linux).
_distutils_cflags = distutils.sysconfig.get_config_var("CFLAGS") or ''
cflags = _distutils_cflags + (
    (' ' + os.environ['CFLAGS']) if os.environ.get("CFLAGS") else '')
cflags = ('CFLAGS="%s"' % (cflags, )) if cflags else ''

# Use -r, not -e, for support of old solaris. See
# https://github.com/gevent/gevent/issues/777
ares_configure_command = ' '.join([
    "(cd ",
    quoted_dep_abspath('c-ares'),
    " && if [ -r ares_build.h ]; then cp ares_build.h ares_build.h.orig; fi ",
    " && sh ./configure --disable-dependency-tracking -C " + cflags,
示例#4
0
from _setuputils import WIN
from _setuputils import quoted_dep_abspath
from _setuputils import system
from _setuputils import make_universal_header
from _setuputils import should_embed
from _setuputils import LIBRARIES
from _setuputils import DEFINE_MACROS
from _setuputils import glob_many
from _setuputils import dep_abspath
from _setuputils import RUNNING_ON_CI
from _setuputils import RUNNING_FROM_CHECKOUT
from _setuputils import cythonize1


CARES_EMBED = should_embed('c-ares')


# See #616, trouble building for a 32-bit python against a 64-bit platform
_config_vars = distutils.sysconfig.get_config_var("CFLAGS")
if _config_vars and "m32" in _config_vars:
    _m32 = 'CFLAGS="' + os.getenv('CFLAGS', '') + ' -m32" '
else:
    _m32 = ''

# Use -r, not -e, for support of old solaris. See
# https://github.com/gevent/gevent/issues/777
ares_configure_command = ' '.join([
    "(cd ", quoted_dep_abspath('c-ares'),
    " && if [ -r ares_build.h ]; then cp ares_build.h ares_build.h.orig; fi ",
    " && sh ./configure --disable-dependency-tracking -C " + _m32 + "CONFIG_COMMANDS= ",
示例#5
0
import os.path

from _setuputils import Extension

from _setuputils import system
from _setuputils import quoted_dep_abspath
from _setuputils import WIN
from _setuputils import make_universal_header
from _setuputils import LIBRARIES
from _setuputils import DEFINE_MACROS
from _setuputils import glob_many
from _setuputils import dep_abspath
from _setuputils import should_embed


LIBEV_EMBED = should_embed('libev')

# Configure libev in place; but cp the config.h to the old directory;
# if we're building a CPython extension, the old directory will be
# the build/temp.XXX/libev/ directory. If we're building from a
# source checkout on pypy, OLDPWD will be the location of setup.py
# and the PyPy branch will clean it up.
libev_configure_command = ' '.join([
    "(cd ", quoted_dep_abspath('libev'),
    " && /bin/sh ./configure ",
    " && cp config.h \"$OLDPWD\"",
    ")",
    '> configure-output.txt'
])

示例#6
0
from cffi import FFI

sys.path.append(".")

try:
    import _setuputils
except ImportError:
    print("This file must be imported with setup.py in the current working dir.")
    raise


__all__ = []

WIN = sys.platform.startswith('win32')
LIBUV_EMBED = _setuputils.should_embed('libuv')


ffi = FFI()

thisdir = os.path.dirname(os.path.abspath(__file__))
setup_py_dir = os.path.abspath(os.path.join(thisdir, '..', '..', '..'))
libuv_dir = os.path.abspath(os.path.join(setup_py_dir, 'deps', 'libuv'))

def read_source(name):
    with open(os.path.join(thisdir, name), 'r') as f:
        return f.read()

_cdef = read_source('_corecffi_cdef.c')
_source = read_source('_corecffi_source.c')