def copytree_and_gzip(self, source_dir, target_dir):
<EOL>build_list = []<EOL>for (dirpath, dirnames, filenames) in os.walk(source_dir):<EOL><INDENT>for f in filenames:<EOL><INDENT>source_path = os.path.join(dirpath, f)<EOL>rel_path = os.path.relpath(dirpath, source_dir)<EOL>target_path = os.path.join(target_dir, rel_path, f)<EOL>build_list.append((source_path, target_path))<EOL><DEDENT><DEDENT>logger.debug("<STR_LIT>".format(len(build_list)))<EOL>if not getattr(self, '<STR_LIT>', False):<EOL><INDENT>[self.copyfile_and_gzip(*u) for u in build_list]<EOL><DEDENT>else:<EOL><INDENT>cpu_count = multiprocessing.cpu_count()<EOL>logger.debug("<STR_LIT>".format(cpu_count))<EOL>pool = ThreadPool(processes=cpu_count)<EOL>pool.map(self.pooled_copyfile_and_gzip, build_list)<EOL><DEDENT>
Copies the provided source directory to the provided target directory.

Gzips JavaScript, CSS and HTML and other files along the way.