def expand_zip(zip_fname,cwd=None):
unzip_path = '<STR_LIT>'<EOL>if not os.path.exists(unzip_path):<EOL><INDENT>log.error('<STR_LIT>'.format(unzip_path))<EOL>sys.exit(<NUM_LIT:1>)<EOL><DEDENT>args = [unzip_path, zip_fname]<EOL>res = subprocess.Popen(<EOL>[args[<NUM_LIT:0>], '<STR_LIT>', args[<NUM_LIT:1>]], cwd=cwd,<EOL>stdout=subprocess.PIPE,<EOL>stderr=subprocess.PIPE,<EOL>)<EOL>contents = []<EOL>for line in res.stdout.readlines()[<NUM_LIT:3>:-<NUM_LIT:2>]:<EOL><INDENT>contents.append(line.split()[-<NUM_LIT:1>])<EOL><DEDENT>commonprefix = os.path.commonprefix(contents)<EOL>if not commonprefix:<EOL><INDENT>extdir = os.path.join(cwd, os.path.basename(zip_fname[:-<NUM_LIT:4>]))<EOL>args.extend(['<STR_LIT>', os.path.abspath(extdir)])<EOL><DEDENT>process_command(args, cwd=cwd)<EOL>
expand a zip