def forall (generator): v = True try: while v: v = v and next (generator) except StopIteration: pass return v
def map_command_dir (os_commands, dir, command, predicate): if not os.path.isdir (dir): raise Exception ('warning: no such dir: %(dir)s' % locals ()) (root, dirs, files) = next (os.walk (dir)) for file in files: if predicate (os.path.join (root, file)): os_commands.system ('%(command)s %(root)s/%(file)s' % locals (), ignore_errors=True)
def map_command_dir(os_commands, dir, command, predicate): if not os.path.isdir(dir): raise Exception('warning: no such dir: %(dir)s' % locals()) (root, dirs, files) = next(os.walk(dir)) for file in files: if predicate(os.path.join(root, file)): os_commands.system('%(command)s %(root)s/%(file)s' % locals(), ignore_errors=True)
def forall(generator): v = True try: while v: v = v and next(generator) except StopIteration: pass return v
def rewire_binary_dir(self, dir): if not os.path.isdir(dir): raise Exception('not a directory: %(dir)' % locals()) (root, dirs, files) = next(os.walk(dir)) files = [os.path.join(root, f) for f in files] for f in files: must_skip = [s for s in self.skip if s in f] if not must_skip and os.path.isfile(f): self.rewire_mach_o_object_executable_path(f)
def rewire_binary_dir (self, dir): if not os.path.isdir (dir): raise Exception ('not a directory: %(dir)' % locals ()) (root, dirs, files) = next (os.walk (dir)) files = [os.path.join (root, f) for f in files] for f in files: must_skip = [s for s in self.skip if s in f] if not must_skip and os.path.isfile (f): self.rewire_mach_o_object_executable_path (f)
def shadow (src, target, soft=False): '''Symlink files from SRC in TARGET recursively. If SOFT, do not overwrite any existing files in target.''' target = os.path.abspath (target) src = os.path.abspath (src) if not soft or not os.path.exists (target): os.makedirs (target) (root, dirs, files) = next (os.walk (src)) for f in files: t = os.path.join (target, f) if not soft or not os.path.exists (t): os.symlink (os.path.join (root, f), t) for d in dirs: shadow (os.path.join (root, d), os.path.join (target, d), soft)
def shadow(src, target, soft=False): '''Symlink files from SRC in TARGET recursively. If SOFT, do not overwrite any existing files in target.''' target = os.path.abspath(target) src = os.path.abspath(src) if not soft or not os.path.exists(target): os.makedirs(target) (root, dirs, files) = next(os.walk(src)) for f in files: t = os.path.join(target, f) if not soft or not os.path.exists(t): os.symlink(os.path.join(root, f), t) for d in dirs: shadow(os.path.join(root, d), os.path.join(target, d), soft)
def map_dir (func, dir): if not os.path.isdir (dir): raise Exception ('warning: no such dir: %(dir)s' % locals ()) (root, dirs, files) = next (os.walk (dir)) for file in files: func (root, file)
def map_dir(func, dir): if not os.path.isdir(dir): raise Exception('warning: no such dir: %(dir)s' % locals()) (root, dirs, files) = next(os.walk(dir)) for file in files: func(root, file)