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


Python expandlibs.isObject函数代码示例

本文整理汇总了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;未经允许,请勿转载。