• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python expandlibs.isObject函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中expandlibs.isObject函数的典型用法代码示例。如果您正苦于以下问题:Python isObject函数的具体用法?Python isObject怎么用?Python isObject使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: reorder

 def reorder(self, order_list):
     '''Given a list of file names without OBJ_SUFFIX, rearrange self
     so that the object file names it contains are ordered according to
     that list.
     '''
     objs = [o for o in self if isObject(o)]
     if not objs: return
     idx = self.index(objs[0])
     # Keep everything before the first object, then the ordered objects,
     # then any other objects, then any non-objects after the first object
     objnames = dict([(os.path.splitext(os.path.basename(o))[0], o) for o in objs])
     self[0:] = self[0:idx] + [objnames[o] for o in order_list if o in objnames] + \
                [o for o in objs if os.path.splitext(os.path.basename(o))[0] not in order_list] + \
                [x for x in self[idx:] if not isObject(x)]
开发者ID:Anachid,项目名称:mozilla-central,代码行数:14,代码来源:expandlibs_exec.py


示例2: _getOrderedSections

 def _getOrderedSections(self, ordered_symbols):
     '''Given an ordered list of symbols, returns the corresponding list
     of sections following the order.'''
     if conf.EXPAND_LIBS_ORDER_STYLE not in ['linkerscript',
                                             'section-ordering-file']:
         raise Exception('EXPAND_LIBS_ORDER_STYLE "{0}" is not supported'
                         .format(conf.EXPAND_LIBS_ORDER_STYLE))
     finder = SectionFinder([arg for arg in self 
                             if isObject(arg) or 
                             os.path.splitext(arg)[1] == conf.LIB_SUFFIX])
     folded = self._getFoldedSections()
     sections = set()
     ordered_sections = []
     for symbol in ordered_symbols:
         symbol_sections = finder.getSections(symbol)
         all_symbol_sections = []
         for section in symbol_sections:
             if section in folded:
                 if isinstance(folded[section], str):
                     section = folded[section]
                 all_symbol_sections.append(section)
                 all_symbol_sections.extend(folded[section])
             else:
                 all_symbol_sections.append(section)
         for section in all_symbol_sections:
             if not section in sections:
                 ordered_sections.append(section)
                 sections.add(section)
     return ordered_sections
开发者ID:longfeey,项目名称:mozilla-central,代码行数:29,代码来源:expandlibs_exec.py


示例3: _extract

 def _extract(self, args):
     '''When a static library name is found, either extract its contents
     in a temporary directory or use the information found in the
     corresponding lib descriptor.
     '''
     ar_extract = conf.AR_EXTRACT.split()
     newlist = []
     for arg in args:
         if os.path.splitext(arg)[1] == conf.LIB_SUFFIX:
             if os.path.exists(arg + conf.LIBS_DESC_SUFFIX):
                 newlist += self._extract(self._expand_desc(arg))
                 continue
             elif os.path.exists(arg) and (len(ar_extract) or conf.AR == 'lib'):
                 tmp = tempfile.mkdtemp(dir=os.curdir)
                 self.tmp.append(tmp)
                 if conf.AR == 'lib':
                     out = subprocess.check_output([conf.AR, '-NOLOGO', '-LIST', arg])
                     files = out.splitlines()
                     # If lib -list returns a list full of dlls, it's an
                     # import lib.
                     if all(isDynamicLib(f) for f in files):
                         newlist += [arg]
                         continue
                     for f in files:
                         subprocess.call([conf.AR, '-NOLOGO', '-EXTRACT:%s' % f, os.path.abspath(arg)], cwd=tmp)
                 else:
                     subprocess.call(ar_extract + [os.path.abspath(arg)], cwd=tmp)
                 objs = []
                 for root, dirs, files in os.walk(tmp):
                     objs += [relativize(os.path.join(root, f)) for f in files if isObject(f)]
                 newlist += sorted(objs)
                 continue
         newlist += [arg]
     return newlist
开发者ID:JCROM-FxOS,项目名称:b2jc_gecko,代码行数:34,代码来源:expandlibs_exec.py


示例4: makelist

 def makelist(self):
     '''Replaces object file names with a temporary list file, using a
     list format depending on the EXPAND_LIBS_LIST_STYLE variable
     '''
     objs = [o for o in self if isObject(o)]
     if not len(objs): return
     fd, tmp = tempfile.mkstemp(suffix=".list",dir=os.curdir)
     if conf.EXPAND_LIBS_LIST_STYLE == "linkerscript":
         content = ['INPUT("%s")\n' % obj for obj in objs]
         ref = tmp
     elif conf.EXPAND_LIBS_LIST_STYLE == "filelist":
         content = ["%s\n" % obj for obj in objs]
         ref = "-Wl,-filelist," + tmp
     elif conf.EXPAND_LIBS_LIST_STYLE == "list":
         content = ["%s\n" % obj for obj in objs]
         ref = "@" + tmp
     else:
         os.close(fd)
         os.remove(tmp)
         return
     self.tmp.append(tmp)
     f = os.fdopen(fd, "w")
     f.writelines(content)
     f.close()
     idx = self.index(objs[0])
     newlist = self[0:idx] + [ref] + [item for item in self[idx:] if item not in objs]
     self[0:] = newlist
开发者ID:JCROM-FxOS,项目名称:b2jc_gecko,代码行数:27,代码来源:expandlibs_exec.py


示例5: generate

def generate(args):
    desc = LibDescriptor()
    for arg in args:
        if isObject(arg):
            desc['OBJS'].append(os.path.abspath(arg))
        elif os.path.splitext(arg)[1] == conf.LIB_SUFFIX and \
             (os.path.exists(arg) or os.path.exists(arg + conf.LIBS_DESC_SUFFIX)):
            desc['LIBS'].append(os.path.abspath(arg))
    return desc
开发者ID:Anachid,项目名称:mozilla-central,代码行数:9,代码来源:expandlibs_gen.py


示例6: _extract

    def _extract(self, args):
        '''When a static library name is found, either extract its contents
        in a temporary directory or use the information found in the
        corresponding lib descriptor.
        '''
        ar_extract = conf.AR_EXTRACT.split()
        newlist = []

        def lookup(base, f):
            for root, dirs, files in os.walk(base):
                if f in files:
                    return os.path.join(root, f)

        for arg in args:
            if os.path.splitext(arg)[1] == conf.LIB_SUFFIX:
                if os.path.exists(arg + conf.LIBS_DESC_SUFFIX):
                    newlist += self._extract(self._expand_desc(arg))
                    continue
                elif os.path.exists(arg) and (len(ar_extract) or conf.AR == 'lib'):
                    tmp = tempfile.mkdtemp(dir=os.curdir)
                    self.tmp.append(tmp)
                    if conf.AR == 'lib':
                        out = subprocess.check_output([conf.AR, '-NOLOGO', '-LIST', arg])
                        files = out.splitlines()
                        # If lib -list returns a list full of dlls, it's an
                        # import lib.
                        if all(isDynamicLib(f) for f in files):
                            newlist += [arg]
                            continue
                        for f in files:
                            subprocess.call([conf.AR, '-NOLOGO', '-EXTRACT:%s' % f, os.path.abspath(arg)], cwd=tmp)
                    else:
                        subprocess.call(ar_extract + [os.path.abspath(arg)], cwd=tmp)
                    objs = []
                    basedir = os.path.dirname(arg)
                    for root, dirs, files in os.walk(tmp):
                        for f in files:
                            if isObject(f):
                                # If the file extracted from the library also
                                # exists in the directory containing the
                                # library, or one of its subdirectories, use
                                # that instead.
                                maybe_obj = lookup(os.path.join(basedir, os.path.relpath(root, tmp)), f)
                                if maybe_obj:
                                    objs.append(relativize(maybe_obj))
                                else:
                                    objs.append(relativize(os.path.join(root, f)))
                    newlist += sorted(objs)
                    continue
            newlist += [arg]
        return newlist
开发者ID:andrenatal,项目名称:gecko-dev,代码行数:51,代码来源:expandlibs_exec.py


示例7: generate

def generate(args):
    desc = LibDescriptor()
    for arg in args:
        if isObject(arg):
            if os.path.exists(arg):
                desc['OBJS'].append(os.path.abspath(arg))
            else:
                raise Exception("File not found: %s" % arg)
        elif os.path.splitext(arg)[1] == conf.LIB_SUFFIX:
            if os.path.exists(arg) or os.path.exists(arg + conf.LIBS_DESC_SUFFIX):
                desc['LIBS'].append(os.path.abspath(arg))
            else:
                raise Exception("File not found: %s" % arg)
    return desc
开发者ID:Balakrishnan-Vivek,项目名称:gecko-dev,代码行数:14,代码来源:expandlibs_gen.py


示例8: __init__

 def __init__(self, objs):
     '''Creates an instance, given a list of object files.'''
     if not conf.EXPAND_LIBS_ORDER_STYLE in ['linkerscript', 'section-ordering-file']:
         raise Exception('EXPAND_LIBS_ORDER_STYLE "%s" is not supported' % conf.EXPAND_LIBS_ORDER_STYLE)
     self.mapping = {}
     for obj in objs:
         if not isObject(obj) and os.path.splitext(obj)[1] != conf.LIB_SUFFIX:
             raise Exception('%s is not an object nor a static library' % obj)
         for symbol, section in SectionFinder._getSymbols(obj):
             sym = SectionFinder._normalize(symbol)
             if sym in self.mapping:
                 if not section in self.mapping[sym]:
                     self.mapping[sym].append(section)
             else:
                 self.mapping[sym] = [section]
开发者ID:JCROM-FxOS,项目名称:b2jc_gecko,代码行数:15,代码来源:expandlibs_exec.py


示例9: generate

def generate(args):
    desc = LibDescriptor()
    for arg in args:
        if isObject(arg):
            if os.path.exists(arg):
                desc['OBJS'].append(os.path.abspath(arg))
            else:
                raise Exception("File not found: %s" % arg)
        elif os.path.splitext(arg)[1] == conf.LIB_SUFFIX:
            # We want to skip static libraries with the name foo-rs-prelink
            # as they are individually linked for every final library, and
            # thus should not be included in the descriptor file
            if '-rs-prelink' in os.path.basename(arg):
                continue
            if os.path.exists(arg) or os.path.exists(arg + conf.LIBS_DESC_SUFFIX):
                desc['LIBS'].append(os.path.abspath(arg))
            else:
                raise Exception("File not found: %s" % arg)
    return desc
开发者ID:ivaylo5ev,项目名称:gecko-dev,代码行数:19,代码来源:expandlibs_gen.py


示例10: _extract

 def _extract(self, args):
     '''When a static library name is found, either extract its contents
     in a temporary directory or use the information found in the
     corresponding lib descriptor.
     '''
     ar_extract = conf.AR_EXTRACT.split()
     newlist = []
     for arg in args:
         if os.path.splitext(arg)[1] == conf.LIB_SUFFIX:
             if os.path.exists(arg + conf.LIBS_DESC_SUFFIX):
                 newlist += self._extract(self._expand_desc(arg))
             elif os.path.exists(arg) and len(ar_extract):
                 tmp = tempfile.mkdtemp(dir=os.curdir)
                 self.tmp.append(tmp)
                 subprocess.call(ar_extract + [os.path.abspath(arg)], cwd=tmp)
                 objs = []
                 for root, dirs, files in os.walk(tmp):
                     objs += [relativize(os.path.join(root, f)) for f in files if isObject(f)]
                 newlist += objs
             else:
                 newlist += [arg]
         else:
             newlist += [arg]
     return newlist
开发者ID:longfeey,项目名称:mozilla-central,代码行数:24,代码来源:expandlibs_exec.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python expect.Expect类代码示例发布时间:2022-05-24
下一篇:
Python ema_logging.log_to_stderr函数代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap