当前位置: 首页>>代码示例>>Python>>正文


Python Preprocessor.do_if方法代码示例

本文整理汇总了Python中mozbuild.preprocessor.Preprocessor.do_if方法的典型用法代码示例。如果您正苦于以下问题:Python Preprocessor.do_if方法的具体用法?Python Preprocessor.do_if怎么用?Python Preprocessor.do_if使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mozbuild.preprocessor.Preprocessor的用法示例。


在下文中一共展示了Preprocessor.do_if方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: do_if

# 需要导入模块: from mozbuild.preprocessor import Preprocessor [as 别名]
# 或者: from mozbuild.preprocessor.Preprocessor import do_if [as 别名]
 def do_if(self, *args, **kwargs):
     # The C preprocessor handles numbers following C rules, which is a
     # different handling than what our Preprocessor does out of the box.
     # Hack around it enough that the configure tests work properly.
     context = self.context
     def normalize_numbers(value):
         if isinstance(value, types.StringTypes):
             if value[-1:] == 'L' and value[:-1].isdigit():
                 value = int(value[:-1])
         return value
     self.context = self.Context(
         (k, normalize_numbers(v)) for k, v in context.iteritems()
     )
     try:
         return Preprocessor.do_if(self, *args, **kwargs)
     finally:
         self.context = context
开发者ID:bzbarsky,项目名称:spidernode,代码行数:19,代码来源:test_toolchain_helpers.py

示例2: do_if

# 需要导入模块: from mozbuild.preprocessor import Preprocessor [as 别名]
# 或者: from mozbuild.preprocessor.Preprocessor import do_if [as 别名]
 def do_if(self, expression, **kwargs):
     # The C preprocessor handles numbers following C rules, which is a
     # different handling than what our Preprocessor does out of the box.
     # Hack around it enough that the configure tests work properly.
     context = self.context
     def normalize_numbers(value):
         if isinstance(value, types.StringTypes):
             if value[-1:] == 'L' and value[:-1].isdigit():
                 value = int(value[:-1])
         return value
     # Our Preprocessor doesn't handle macros with parameters, so we hack
     # around that for __has_feature()-like things.
     def normalize_has_feature(expr):
         return self.HAS_FEATURE.sub(r'\1\2', expr)
     self.context = self.Context(
         (normalize_has_feature(k), normalize_numbers(v))
         for k, v in context.iteritems()
     )
     try:
         return Preprocessor.do_if(self, normalize_has_feature(expression),
                                   **kwargs)
     finally:
         self.context = context
开发者ID:cliqz-oss,项目名称:browser-f,代码行数:25,代码来源:test_toolchain_helpers.py


注:本文中的mozbuild.preprocessor.Preprocessor.do_if方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。