Lines Matching refs:file

59 def _get_compress_format(file, compress_format_list):
62 if file.endswith(compress_suffix):
68 # which points to the same doc file.
70 # The hardlink10, hardlink11 and hardlink12 are the same file.
71 def _collect_hardlink(hardlink_dict, file):
74 if os.path.samefile(hardlink, file):
75 hardlink_dict[hardlink].append(file)
78 hardlink_dict[file] = []
93 …bb.warn("de/compress file failed %s (cmd was %s)%s" % (retval, cmd, ":\n%s" % output if output els…
114 def _process_symlink(file, compress_format, decompress=False):
118 new_linkname = file[:-len(compress_suffix)]
119 new_source = os.readlink(file)[:-len(compress_suffix)]
122 new_linkname = file + compress_suffix
123 new_source = os.readlink(file) + compress_suffix
129 os.unlink(file)
131 def _is_info(file):
134 if flag in os.path.basename(file):
139 def _is_man(file):
146 if p.search(file):
151 def _is_compress_doc(file, compress_format_list):
152 compress_format = _get_compress_format(file, compress_format_list)
154 if file.endswith(compress_suffix):
156 uncompress_file = file[:-len(compress_suffix)]
167 file = os.path.join(root, f)
168 if os.path.isdir(file):
171 if _is_info(file) or _is_man(file):
173 if os.path.islink(file):
174 _process_symlink(file, compress_mode)
176 elif os.lstat(file).st_nlink > 1:
177 _collect_hardlink(hardlink_dict, file)
178 # Normal file
179 elif os.path.isfile(file):
180 cmd = "%s %s" % (compress_cmds[compress_mode], file)
185 bb.note('compress file %s' % file)
196 file = os.path.join(root, f)
197 if os.path.isdir(file):
200 res, compress_format = _is_compress_doc(file, decompress_cmds.keys())
204 if os.path.islink(file):
205 _process_symlink(file, compress_format, decompress)
207 elif os.lstat(file).st_nlink > 1:
208 _collect_hardlink(hardlink_dict, file)
209 # Normal file
210 elif os.path.isfile(file):
211 cmd = "%s %s" % (decompress_cmds[compress_format], file)
216 bb.note('decompress file %s' % file)