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


Python Main.compile方法代碼示例

本文整理匯總了Python中Cython.Compiler.Main.compile方法的典型用法代碼示例。如果您正苦於以下問題:Python Main.compile方法的具體用法?Python Main.compile怎麽用?Python Main.compile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Cython.Compiler.Main的用法示例。


在下文中一共展示了Main.compile方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: cycompile

# 需要導入模塊: from Cython.Compiler import Main [as 別名]
# 或者: from Cython.Compiler.Main import compile [as 別名]
def cycompile(input_file, options=()):
    from Cython.Compiler import Version, CmdLine, Main
    options, sources = CmdLine.parse_command_line(list(options or ()) + ['--embed', input_file])
    _debug('Using Cython %s to compile %s', Version.version, input_file)
    result = Main.compile(sources, options)
    if result.num_errors > 0:
        sys.exit(1)
開發者ID:7kbird,項目名稱:chrome,代碼行數:9,代碼來源:BuildExecutable.py

示例2: generate_c_from_cython

# 需要導入模塊: from Cython.Compiler import Main [as 別名]
# 或者: from Cython.Compiler.Main import compile [as 別名]
    def generate_c_from_cython(extension, build_dir):
        if not sys.platform == 'darwin':
            print 'No %s will be built for this platform.' % (extension.name)
            return
        from distutils.dep_util import newer_group
        name = extension.name.split('.')[-1]
        source = extension.depends[0]
        target = os.path.join(build_dir, name+'.c')

        if newer_group(extension.depends, target):
            from Cython.Compiler import Main
            options = Main.CompilationOptions(
                defaults=Main.default_options,
                output_file=target)
            cython_result = Main.compile(source, options=options)
            if cython_result.num_errors != 0:
                raise RuntimeError("%d errors in Cython compile" %
                    cython_result.num_errors)
        return target
開發者ID:pib,項目名稱:enable,代碼行數:21,代碼來源:setup.py

示例3: __init__

# 需要導入模塊: from Cython.Compiler import Main [as 別名]
# 或者: from Cython.Compiler.Main import compile [as 別名]
 def __init__(self, *args, **kwargs):
     for src in glob('borg/*.pyx'):
         cython_compiler.compile(src, cython_compiler.default_options)
     super().__init__(*args, **kwargs)
開發者ID:Herover,項目名稱:borg,代碼行數:6,代碼來源:setup.py

示例4: cython_extension

# 需要導入模塊: from Cython.Compiler import Main [as 別名]
# 或者: from Cython.Compiler.Main import compile [as 別名]
def cython_extension(srcfile):
    options = Main.CompilationOptions(include_path=[os.path.join(os.path.abspath(os.path.dirname(__file__)), 'include')])
    Main.compile(srcfile, options=options)
開發者ID:amitibo,項目名稱:regreg,代碼行數:5,代碼來源:setup.py

示例5: __init__

# 需要導入模塊: from Cython.Compiler import Main [as 別名]
# 或者: from Cython.Compiler.Main import compile [as 別名]
 def __init__(self, *args, **kwargs):
     for src in glob('msgpack/*.pyx'):
         cython_compiler.compile(glob('msgpack/*.pyx'),
                                 cython_compiler.default_options)
     sdist.__init__(self, *args, **kwargs)
開發者ID:Keith-Redding,項目名稱:msgpack,代碼行數:7,代碼來源:setup.py

示例6: __init__

# 需要導入模塊: from Cython.Compiler import Main [as 別名]
# 或者: from Cython.Compiler.Main import compile [as 別名]
 def __init__(self, *args, **kwargs):
     for src in glob('borg/*.pyx'):
         cython_compiler.compile(src, cython_compiler.default_options)
     versioneer.cmd_sdist.__init__(self, *args, **kwargs)
開發者ID:brodul,項目名稱:borg,代碼行數:6,代碼來源:setup.py

示例7: print

# 需要導入模塊: from Cython.Compiler import Main [as 別名]
# 或者: from Cython.Compiler.Main import compile [as 別名]
    cmdclass['build_ext'] = build_pyx
else:
    ext.sources[0] = 'fplib.cpp'

# This silly hack, inspired by the pymt setup.py, runs Cython if we're
# doing a source distribution. The MANIFEST.in file ensures that the
# C++ source is included in the tarball also.
if 'sdist' in sys.argv:
    if not HAVE_CYTHON:
        print('We need Cython to build a source distribution.')
        sys.exit(1)
    from Cython.Compiler import Main
    source = ext.sources[0] # hacky!
    Main.compile(
        source,
        cplus = True,
        full_module_name = ext.name,
    )

setup(
    name = 'pylastfp',
    version = '0.6',
    description = "bindings for Last.fm's acoustic fingerprinting (fplib)",
    author = 'Adrian Sampson',
    author_email = '[email protected]',
    url = 'http://github.com/sampsyo/pylastfp/',
    license = 'LGPL',
    platforms = 'ALL',
    long_description = _read('README.rst'),
    classifiers = [
        'Topic :: Multimedia :: Sound/Audio :: Analysis',
開發者ID:beetbox,項目名稱:pylastfp,代碼行數:33,代碼來源:setup.py

示例8:

# 需要導入模塊: from Cython.Compiler import Main [as 別名]
# 或者: from Cython.Compiler.Main import compile [as 別名]
    pypissh.monkeypatch()

DEBUG = False

src_dir = 'src'
ext_dir = os.path.join(src_dir,'ext')
build_dir = 'build'
cchardet_dir = os.path.join(src_dir,'cchardet/')
charsetdetect_dir = os.path.join(ext_dir, 'libcharsetdetect/')
nspr_emu_dir = os.path.join(charsetdetect_dir,"nspr-emu/")
uchardet_dir = os.path.join(charsetdetect_dir,"mozilla/extensions/universalchardet/src/base/")

if have_cython:
    pyx_sources = glob.glob(cchardet_dir+'*.pyx')
    sys.stderr.write("cythonize: %r\n" % (pyx_sources,))
    cython_compiler.compile(pyx_sources,options=cython_compiler.CompilationOptions(cplus=True))
cchardet_sources = glob.glob(cchardet_dir+'*.cpp')
sources = cchardet_sources  + [os.path.join(charsetdetect_dir,"charsetdetect.cpp")] + glob.glob(uchardet_dir+'*.cpp')

macros = []
extra_compile_args = []
extra_link_args = []

if platform.system() == "Windows":
    macros.append(("WIN32","1"))

if DEBUG:
    macros.append(("DEBUG_chardet","1"))
    extra_compile_args.append("-g"),
    extra_link_args.append("-g"),
開發者ID:MoonDav,項目名稱:cChardet,代碼行數:32,代碼來源:setup.py

示例9: cythonize_all

# 需要導入模塊: from Cython.Compiler import Main [as 別名]
# 或者: from Cython.Compiler.Main import compile [as 別名]
def cythonize_all(relpath):
    """Cythonize all Cython modules in relative path"""
    from Cython.Compiler import Main
    for fname in os.listdir(relpath):
        if osp.splitext(fname)[1] == '.pyx':
            Main.compile(osp.join(relpath, fname))
開發者ID:artillan,項目名稱:guidata,代碼行數:8,代碼來源:utils.py

示例10: cythonize

# 需要導入模塊: from Cython.Compiler import Main [as 別名]
# 或者: from Cython.Compiler.Main import compile [as 別名]
def cythonize(src):
  sys.stderr.write("cythonize: %r\n" % (src,))
  cython_compiler.compile([src])
開發者ID:thenaran,項目名稱:clique,代碼行數:5,代碼來源:setup.py

示例11: __init__

# 需要導入模塊: from Cython.Compiler import Main [as 別名]
# 或者: from Cython.Compiler.Main import compile [as 別名]
 def __init__(self, *args, **kwargs):
     for src in cython_sources:
         cython_compiler.compile(src, cython_compiler.default_options)
     super().__init__(*args, **kwargs)
開發者ID:EpicDiehard,項目名稱:borg,代碼行數:6,代碼來源:setup.py

示例12: cythonize

# 需要導入模塊: from Cython.Compiler import Main [as 別名]
# 或者: from Cython.Compiler.Main import compile [as 別名]
def cythonize(src):
    sys.stderr.write("cythonize: %r\n" % (src,))
    cython_compiler.compile([src], cplus=True, emit_linenums=True)
開發者ID:purplecow,項目名稱:msgpack-python,代碼行數:5,代碼來源:setup.py

示例13: __init__

# 需要導入模塊: from Cython.Compiler import Main [as 別名]
# 或者: from Cython.Compiler.Main import compile [as 別名]
 def __init__(self, *args, **kwargs):
     cy_opt = cython_compiler.default_options.copy()
     cy_opt["cplus"] = True
     for src in glob("msgpack/*.pyx"):
         cython_compiler.compile(glob("msgpack/*.pyx"), cy_opt)
     sdist.__init__(self, *args, **kwargs)
開發者ID:kanosaki,項目名稱:msgpack-python,代碼行數:8,代碼來源:setup.py

示例14: __init__

# 需要導入模塊: from Cython.Compiler import Main [as 別名]
# 或者: from Cython.Compiler.Main import compile [as 別名]
 def __init__(self, *args, **kwargs):
   for src in glob('timeuuid/*.pyx'):
     print src
     Main.compile(glob('timeuuid/*.pyx'),
                  Main.default_options)
   sdist.__init__(self, *args, **kwargs)
開發者ID:chisrcastro,項目名稱:python-timeuuid,代碼行數:8,代碼來源:setup.py


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