本文整理汇总了Python中distutils.core.Extension.optional方法的典型用法代码示例。如果您正苦于以下问题:Python Extension.optional方法的具体用法?Python Extension.optional怎么用?Python Extension.optional使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类distutils.core.Extension
的用法示例。
在下文中一共展示了Extension.optional方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Extension
# 需要导入模块: from distutils.core import Extension [as 别名]
# 或者: from distutils.core.Extension import optional [as 别名]
CORE = Extension(name='gevent.core',
sources=['gevent/gevent.core.c'],
include_dirs=['libev'] if libev_embed else [],
libraries=libraries,
define_macros=define_macros,
depends=expand('gevent/callbacks.*', 'gevent/stathelper.c', 'gevent/libev*.h', 'libev/*.*'))
# QQQ libev can also use -lm, however it seems to be added implicitly
ARES = Extension(name='gevent.ares',
sources=['gevent/gevent.ares.c'],
include_dirs=['c-ares'] if ares_embed else [],
libraries=libraries,
define_macros=define_macros,
depends=expand('gevent/dnshelper.c', 'gevent/cares_*.*'))
ARES.optional = True
ext_modules = [CORE,
ARES,
Extension(name="gevent._semaphore",
sources=["gevent/gevent._semaphore.c"]),
Extension(name="gevent._util",
sources=["gevent/gevent._util.c"])]
def make_universal_header(filename, *defines):
defines = [('#define %s ' % define, define) for define in defines]
lines = open(filename, 'r').read().split('\n')
ifdef = 0
f = open(filename, 'w')
示例2: skipped
# 需要导入模块: from distutils.core import Extension [as 别名]
# 或者: from distutils.core.Extension import optional [as 别名]
# disable osutil.c under windows + python 2.4 (issue1364)
if sys.platform == 'win32' and sys.version_info < (2, 5, 0, 'final'):
pymodules.append('mercurial.pure.osutil')
else:
extmodules.append(Extension('mercurial.osutil', ['mercurial/osutil.c']))
if sys.platform.startswith('linux') and os.uname()[2] > '2.6':
# The inotify extension is only usable with Linux 2.6 kernels.
# You also need a reasonably recent C library.
# In any case, if it fails to build the error will be skipped ('optional').
cc = new_compiler()
if hasfunction(cc, 'inotify_add_watch'):
inotify = Extension('hgext.inotify.linux._inotify',
['hgext/inotify/linux/_inotify.c'],
['mercurial'])
inotify.optional = True
extmodules.append(inotify)
packages.extend(['hgext.inotify', 'hgext.inotify.linux'])
packagedata = {'mercurial': ['locale/*/LC_MESSAGES/hg.mo',
'help/*.txt']}
def ordinarypath(p):
return p and p[0] != '.' and p[-1] != '~'
for root in ('templates',):
for curdir, dirs, files in os.walk(os.path.join('mercurial', root)):
curdir = curdir.split(os.sep, 1)[1]
dirs[:] = filter(ordinarypath, dirs)
for f in filter(ordinarypath, files):
f = os.path.join(curdir, f)