示例#1
0
    def handle_egg_dir(self, dpath, file_names):
        path, dname = dpath.rsplit('/', 1)
        if self.is_dbg_package and self.options.clean_dbg_pkg:
            rmtree(dpath)
            return

        clean_name = clean_egg_name(dname)
        if clean_name != dname:
            if exists(join(path, clean_name)):
                log.info('removing %s (%s is already available)', dname, clean_name)
                rmtree(dpath)
                return
            else:
                log.info('renaming %s to %s', dname, clean_name)
                os.rename(dpath, join(path, clean_name))
                dname = clean_name
                dpath = join(path, dname)
        if file_names:
            if 'requires.txt' in file_names:
                self.result['requires.txt'].add(join(dpath, 'requires.txt'))
            if 'namespace_packages.txt' in file_names:
                self.result['nsp.txt'].add(join(dpath, 'namespace_packages.txt'))
            if 'SOURCES.txt' in file_names:
                os.remove(join(dpath, 'SOURCES.txt'))
                file_names.remove('SOURCES.txt')
示例#2
0
文件: fs.py 项目: iN3O/HITCON2014
 def handle_egg_file(self, fpath):
     root, name = fpath.rsplit('/', 1)
     clean_name = clean_egg_name(name)
     if clean_name != name:
         if exists(join(root, clean_name)):
             log.info('removing %s (%s is already available)',
                      name, clean_name)
             os.remove(fpath)
         else:
             log.info('renaming %s to %s', name, clean_name)
             os.rename(fpath, join(root, clean_name))