def check_cython_version(self):
     from Cython.Compiler.Version import version as cython_version
     if tuple(int(x) for x in cython_version.split(
             ".")) < self.cython_version_required:
         raise DistutilsError(
             "Cython version %s or higher needed" %
             ".".join(str(i) for i in self.cython_version_required))
예제 #2
0
def validate_cython(cython):
    """Called if Cython imports, does further version checks."""
    from Cython.Compiler.Version import version

    min_version = (0, 11, 2)
    cython_version = tuple([int(x) for x in version.split('.')])
    msg = "Cython version %s found, at least %s required" % (cython_version,
                                                             min_version)
    nt.assert_true(cython_version >= min_version, msg)
예제 #3
0
파일: setup.py 프로젝트: svn2github/Xpra
def cython_version_check():
    from Cython.Compiler.Version import version as cython_version_string
    cython_version = [int(part) for part in cython_version_string.split(".")]
    # This was when the 'for 0 < i < 10:' syntax as added, bump upwards as
    # necessary:
    NEEDED_CYTHON = (0, 14, 0)
    if tuple(cython_version) < NEEDED_CYTHON:
        sys.exit("ERROR: Your version of Cython is too old to build this package\n"
                 "You have version %s\n"
                 "Please upgrade to Cython %s or better"
                 % (cython_version_string,
                    ".".join([str(part) for part in NEEDED_CYTHON])))
예제 #4
0
def make_cython_version():
    pxi = ("# Cython compile-time version information\n"
           "DEF CYTHON_VERSION_MAJOR = {major}\n"
           "DEF CYTHON_VERSION_MINOR = {minor}\n"
           "DEF CYTHON_VERSION_BUILD = {build}")
    cyver = CYTHON_VERSION.split('-')[0].split('.')
    while len(cyver) < 3:
        cyver = cyver + [0]
    cyver = dict([(k, int(cv)) for k, cv in zip(['major', 'minor', 'build'], cyver)])
    pxi = pxi.format(**cyver)
    with open('jsoncpp/includes/cython_version.pxi', 'w') as f:
        f.write(pxi)
예제 #5
0
def make_cython_version():
    pxi = ("# Cython compile-time version information\n"
           "DEF CYTHON_VERSION_MAJOR = {major}\n"
           "DEF CYTHON_VERSION_MINOR = {minor}\n"
           "DEF CYTHON_VERSION_BUILD = {build}")
    cyver = CYTHON_VERSION.split('-')[0].split('.')
    while len(cyver) < 3:
        cyver = cyver + [0]
    cyver = dict([(k, int(cv))
                  for k, cv in zip(['major', 'minor', 'build'], cyver)])
    pxi = pxi.format(**cyver)
    with open('jsoncpp/includes/cython_version.pxi', 'w') as f:
        f.write(pxi)
예제 #6
0
파일: setup.py 프로젝트: rudresh2319/Xpra
def cython_version_check():
    from Cython.Compiler.Version import version as cython_version_string
    cython_version = [int(part) for part in cython_version_string.split(".")]
    # This was when the 'for 0 < i < 10:' syntax as added, bump upwards as
    # necessary:
    NEEDED_CYTHON = (0, 14, 0)
    if tuple(cython_version) < NEEDED_CYTHON:
        sys.exit(
            "ERROR: Your version of Cython is too old to build this package\n"
            "You have version %s\n"
            "Please upgrade to Cython %s or better" %
            (cython_version_string, ".".join(
                [str(part) for part in NEEDED_CYTHON])))
예제 #7
0
def cython_version():
    pxi = ("# Cython compile-time version information\n"
           "DEF CYTHON_VERSION_MAJOR = {major}\n"
           "DEF CYTHON_VERSION_MINOR = {minor}\n"
           "DEF CYTHON_VERSION_MICRO = {micro}")
    cyver = CYTHON_VERSION.split('-')[0].split('.')
    while len(cyver) < 3:
        cyver = cyver + [0]
    cyver = dict([(k, int(cv)) for k, cv in zip(['major', 'minor', 'micro'], cyver)])
    pxi = pxi.format(**cyver)
    basedir = os.path.split(__file__)[0]
    incldir = os.path.join(basedir, 'pyne', 'include')
    if not os.path.exists(incldir):
        os.mkdir(incldir)
    with open(os.path.join(incldir, 'cython_version.pxi'), 'w') as f:
        f.write(pxi)
예제 #8
0
파일: configure.py 프로젝트: tewk/xdress
def cython_version():
    pxi = ("# Cython compile-time version information\n"
           "DEF CYTHON_VERSION_MAJOR = {major}\n"
           "DEF CYTHON_VERSION_MINOR = {minor}\n"
           "DEF CYTHON_VERSION_MICRO = {micro}")
    cyver = CYTHON_VERSION.split('-')[0].split('.')
    while len(cyver) < 3:
        cyver = cyver + [0]
    cyver = dict([(k, int(cv))
                  for k, cv in zip(['major', 'minor', 'micro'], cyver)])
    pxi = pxi.format(**cyver)
    basedir = os.path.split(__file__)[0]
    incldir = os.path.join(basedir, 'bright', 'include')
    if not os.path.exists(incldir):
        os.mkdir(incldir)
    with open(os.path.join(incldir, 'cython_version.pxi'), 'w') as f:
        f.write(pxi)
예제 #9
0
def chk_cython(VERSION):
    CYTHON_VERSION_REQUIRED = VERSION
    from distutils import log
    from distutils.version import StrictVersion as Version
    warn = lambda msg='': sys.stderr.write(msg + '\n')
    #
    cython_zip = 'cython.zip'
    if os.path.isfile(cython_zip):
        path = os.path.abspath(cython_zip)
        if sys.path[0] != path:
            sys.path.insert(0, path)
            log.info("adding '%s' to sys.path", cython_zip)
    #
    try:
        import Cython
    except ImportError:
        warn("*" * 80)
        warn()
        warn(" You need to generate C source files with Cython!!")
        warn(" Download and install Cython <http://www.cython.org>")
        warn()
        warn("*" * 80)
        return False
    #
    try:
        CYTHON_VERSION = Cython.__version__
    except AttributeError:
        from Cython.Compiler.Version import version as CYTHON_VERSION
    CYTHON_VERSION = CYTHON_VERSION.split('+', 1)[0]
    for s in ('.alpha', 'alpha'):
        CYTHON_VERSION = CYTHON_VERSION.replace(s, 'a')
    for s in ('.beta', 'beta', '.rc', 'rc', '.c', 'c'):
        CYTHON_VERSION = CYTHON_VERSION.replace(s, 'b')
    if (CYTHON_VERSION_REQUIRED is not None
            and Version(CYTHON_VERSION) < Version(CYTHON_VERSION_REQUIRED)):
        warn("*" * 80)
        warn()
        warn(" You need to install Cython %s (you have version %s)" %
             (CYTHON_VERSION_REQUIRED, CYTHON_VERSION))
        warn(" Download and install Cython <http://www.cython.org>")
        warn()
        warn("*" * 80)
        return False
    #
    return True
예제 #10
0
파일: setup.py 프로젝트: hoyajigi/openmp
def chk_cython(VERSION):
    CYTHON_VERSION_REQUIRED = VERSION
    from distutils import log
    from distutils.version import StrictVersion as Version
    warn = lambda msg='': sys.stderr.write(msg+'\n')
    #
    cython_zip = 'cython.zip'
    if os.path.isfile(cython_zip):
        path = os.path.abspath(cython_zip)
        if sys.path[0] != path:
            sys.path.insert(0, path)
            log.info("adding '%s' to sys.path", cython_zip)
    #
    try:
        import Cython
    except ImportError:
        warn("*"*80)
        warn()
        warn(" You need to generate C source files with Cython!!")
        warn(" Download and install Cython <http://www.cython.org>")
        warn()
        warn("*"*80)
        return False
    #
    try:
        CYTHON_VERSION = Cython.__version__
    except AttributeError:
        from Cython.Compiler.Version import version as CYTHON_VERSION
    CYTHON_VERSION = CYTHON_VERSION.split('+', 1)[0]
    for s in ('.alpha', 'alpha'):
        CYTHON_VERSION = CYTHON_VERSION.replace(s, 'a')
    for s in ('.beta',  'beta', '.rc', 'rc', '.c', 'c'):
        CYTHON_VERSION = CYTHON_VERSION.replace(s, 'b')
    if (CYTHON_VERSION_REQUIRED is not None and
        Version(CYTHON_VERSION) < Version(CYTHON_VERSION_REQUIRED)):
        warn("*"*80)
        warn()
        warn(" You need to install Cython %s (you have version %s)"
             % (CYTHON_VERSION_REQUIRED, CYTHON_VERSION))
        warn(" Download and install Cython <http://www.cython.org>")
        warn()
        warn("*"*80)
        return False
    #
    return True
예제 #11
0
파일: configure.py 프로젝트: kif/xdress
def cython_version():
    pxi = (
        "# Cython compile-time version information\n"
        "DEF CYTHON_VERSION_MAJOR = {major}\n"
        "DEF CYTHON_VERSION_MINOR = {minor}\n"
        "DEF CYTHON_VERSION_MICRO = {micro}"
    )
    cyver = CYTHON_VERSION.split("-")[0].split(".")
    while len(cyver) < 3:
        cyver = cyver + [0]
    cyver = dict([(k, int(cv)) for k, cv in zip(["major", "minor", "micro"], cyver)])
    pxi = pxi.format(**cyver)
    basedir = os.path.split(__file__)[0]
    incldir = os.path.join(basedir, "bright", "include")
    if not os.path.exists(incldir):
        os.mkdir(incldir)
    with open(os.path.join(incldir, "cython_version.pxi"), "w") as f:
        f.write(pxi)
예제 #12
0
 def check_cython_version(self):
     from Cython.Compiler.Version import version as cython_version
     if tuple(int(x) for x in cython_version.split(".")) < self.cython_version_required:
         raise DistutilsError("Cython version %s or higher needed" % ".".join(str(i) for i in self.cython_version_required))
예제 #13
0
def cython_version():
    if no_cython:
        return None
    from Cython.Compiler.Version import version
    return tuple(int(v) for v in version.split('.'))
예제 #14
0
from distutils.core import setup
from distutils.extension import Extension

try:
    from Cython.Distutils import build_ext
    from Cython.Compiler.Version import version
    if int(version.split(".")[1]) < 19:
        raise ImportError("Bad version.")

except ImportError:
    use_cython = False
else:
    use_cython = True


ext_modules = [ ]
cmdclass = {}

if use_cython:
    ext_modules = [Extension("pydecode.hyper",
                             ["python/pydecode/hyper.pyx",
                              "src/Hypergraph/Hypergraph.cpp",
                              "src/Hypergraph/Algorithms.cpp",
                              "src/Hypergraph/Semirings.cpp",
                              "src/Hypergraph/BeamSearch.cpp",
                              ],

                             language='c++',
                             extra_compile_args=["-O2", "-ggdb"], #'-O2',
                             include_dirs=[r'src/', "."],
                             )]
예제 #15
0
    if status!=0 and not ('clean' in sys.argv):
        raise Exception("call to pkg-config ('%s') failed" % (cmd,))
    for token in output.split():
        if flag_map.has_key(token[:2]):
            kw.setdefault(flag_map.get(token[:2]), []).append(token[2:])
        else: # throw others to extra_link_args
            kw.setdefault('extra_link_args', []).append(token)
        for k, v in kw.iteritems(): # remove duplicates
            kw[k] = list(set(v))
    return kw

from xpra.platform import XPRA_LOCAL_SERVERS_SUPPORTED
if XPRA_LOCAL_SERVERS_SUPPORTED:
    from Cython.Distutils import build_ext
    from Cython.Compiler.Version import version as cython_version_string
    cython_version = [int(part) for part in cython_version_string.split(".")]
    # This was when the 'for 0 < i < 10:' syntax as added, bump upwards as
    # necessary:
    NEEDED_CYTHON = (0, 14, 0)
    if tuple(cython_version) < NEEDED_CYTHON:
        sys.exit("ERROR: Your version of Cython is too old to build this package\n"
                 "You have version %s\n"
                 "Please upgrade to Cython %s or better"
                 % (cython_version_string,
                    ".".join([str(part) for part in NEEDED_CYTHON])))

    ext_modules = [
      Extension("wimpiggy.lowlevel.bindings",
                ["wimpiggy/lowlevel/bindings.pyx"],
                **pkgconfig("pygobject-2.0", "gdk-x11-2.0", "gtk+-x11-2.0",
                            "xtst", "xfixes", "xcomposite", "xdamage", "xrandr")
예제 #16
0
파일: gen_config.py 프로젝트: Teslos/fwrap
def _get_cy_version():
    from Cython.Compiler.Version import version
    major, minor = version.split('.')[:2]
    return (int(major), int(minor))
예제 #17
0
def cython_version():
    if no_cython:
        return None
    from Cython.Compiler.Version import version

    return tuple(int(v) for v in version.split("."))
예제 #18
0
def _get_cy_version():
    from Cython.Compiler.Version import version
    major, minor = version.split('.')[:2]
    return (int(major), int(minor))