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


Python Distutils.build_ext方法代碼示例

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


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

示例1: setup_package

# 需要導入模塊: from Cython import Distutils [as 別名]
# 或者: from Cython.Distutils import build_ext [as 別名]
def setup_package():

    metadata = dict(name=spfeas_name,
                    maintainer=maintainer,
                    maintainer_email=maintainer_email,
                    description=description,
                    license=license_file,
                    version=__version__,
                    long_description=long_description,
                    author=author_file,
                    packages=get_packages(),
                    package_data=get_package_data(),
                    ext_modules=cythonize(get_pyx_list()),
                    include_dirs=[np.get_include()],
                    cmdclass=dict(build_ext=build_ext),
                    zip_safe=False,
                    download_url=git_url,
                    install_requires=required_packages,
                    entry_points=get_console_dict())

    setup(**metadata) 
開發者ID:jgrss,項目名稱:spfeas,代碼行數:23,代碼來源:setup.py

示例2: __getitem__

# 需要導入模塊: from Cython import Distutils [as 別名]
# 或者: from Cython.Distutils import build_ext [as 別名]
def __getitem__(self, key):
        if key != 'build_ext':
            return super(LazyBuildExtCommandClass, self).__getitem__(key)

        from Cython.Distutils import build_ext as cython_build_ext
        import numpy

        # Cython_build_ext isn't a new-style class in Py2.
        class build_ext(cython_build_ext, object):
            """
            Custom build_ext command that lazily adds numpy's include_dir to
            extensions.
            """
            def build_extensions(self):
                """
                Lazily append numpy's include directory to Extension includes.

                This is done here rather than at module scope because setup.py
                may be run before numpy has been installed, in which case
                importing numpy and calling `numpy.get_include()` will fail.
                """
                numpy_incl = numpy.get_include()
                for ext in self.extensions:
                    ext.include_dirs.append(numpy_incl)

                super(build_ext, self).build_extensions()
        return build_ext 
開發者ID:zhanghan1990,項目名稱:zipline-chinese,代碼行數:29,代碼來源:setup.py

示例3: __getitem__

# 需要導入模塊: from Cython import Distutils [as 別名]
# 或者: from Cython.Distutils import build_ext [as 別名]
def __getitem__(self, key):
        if key != 'build_ext':
            return super(LazyBuildExtCommandClass, self).__getitem__(key)

        from Cython.Distutils import build_ext as cython_build_ext
        import numpy

        # Cython_build_ext isn't a new-style class in Py2.
        class build_ext(cython_build_ext, object):
            """
            Custom build_ext command that lazily adds numpy's include_dir to
            extensions.
            """

            def build_extensions(self):
                """
                Lazily append numpy's include directory to Extension includes.

                This is done here rather than at module scope because setup.py
                may be run before numpy has been installed, in which case
                importing numpy and calling `numpy.get_include()` will fail.
                """
                numpy_incl = numpy.get_include()
                for ext in self.extensions:
                    ext.include_dirs.append(numpy_incl)

                super(build_ext, self).build_extensions()

        return build_ext 
開發者ID:enigmampc,項目名稱:catalyst,代碼行數:31,代碼來源:setup.py

示例4: _get_ext_modules

# 需要導入模塊: from Cython import Distutils [as 別名]
# 或者: from Cython.Distutils import build_ext [as 別名]
def _get_ext_modules():
  #build cython files
  # python3 setup.py build_ext --inplace
  path_parts = [MODULE_NAME, 'analysis', 'ske_create', 'segWormPython', 'cython_files']
  cython_path = os.path.join(*path_parts)
  cython_path_e = os.path.join(MODULE_NAME, 'analysis', 'stage_aligment')

  def _add_path(f_list):
  	return [os.path.join(cython_path, x) for x in f_list]

  def _get_mod_path(name):
      return '.'.join(path_parts + [name])

  ext_files = {
  	"circCurvature" : ["circCurvature.pyx", "c_circCurvature.c"],
  	"curvspace" : ["curvspace.pyx", "c_curvspace.c"]
  }

  include_dirs = [numpy.get_include()]
  ext_modules = cythonize(os.path.join(cython_path, "*_cython.pyx"))
  ext_modules += cythonize(os.path.join(cython_path_e, "*.pyx"))
  ext_modules += [Extension(_get_mod_path(name), 
                            sources=_add_path(files), 
                            include_dirs=include_dirs) 
  			   for name, files in ext_files.items()]
  return ext_modules 
開發者ID:ver228,項目名稱:tierpsy-tracker,代碼行數:28,代碼來源:setup.py

示例5: get_ext_modules

# 需要導入模塊: from Cython import Distutils [as 別名]
# 或者: from Cython.Distutils import build_ext [as 別名]
def get_ext_modules(use_cython=USE_CYTHON):
    
    global cmdclass
    python_header_dir = get_python_header_dir()

    if use_cython:
        try:
            from Cython.Distutils import build_ext
        except ImportError:
            stderr.write('\"cython\" is not installed. Forcing \"USE_CYTHON\" '
                         'to \"False\" in order to install.\n')
            use_cython = False

    if use_cython:
        ext_modules = [Extension('src.features',
                                 ['src/features.pyx'],
                                 include_dirs=[python_header_dir]),
                       Extension('src.experiments',
                                 ['src/experiments.pyx'],
                                 include_dirs=[python_header_dir]),
                       Extension('src.datasets',
                                 ['src/datasets.pyx'],
                                 include_dirs=[python_header_dir]),
                       Extension('src.mongodb',
                                 ['src/mongodb.pyx'],
                                 include_dirs=[python_header_dir])]
        cmdclass.update({'build_ext': build_ext})
        return ext_modules

    ext_modules = [Extension('src.features',
                             ['src/features.c'],
                             include_dirs=[python_header_dir]),
                   Extension('src.experiments',
                             ['src/experiments.pyx'],
                             include_dirs=[python_header_dir]),
                   Extension('src.datasets',
                             ['src/datasets.c'],
                             include_dirs=[python_header_dir]),
                   Extension('src.mongodb',
                             ['src/mongodb.c'],
                             include_dirs=[python_header_dir])]
    return ext_modules 
開發者ID:mulhod,項目名稱:reviewer_experience_prediction,代碼行數:44,代碼來源:setup.py


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