@staticmethod<EOL><INDENT>def mkzip(source_dir, output_filename):<DEDENT>
zipf = zipfile.ZipFile(output_filename, '<STR_LIT:w>', zipfile.zlib.DEFLATED)<EOL>pre_len = len(os.path.dirname(source_dir))<EOL>for parent, dirnames, filenames in os.walk(source_dir):<EOL><INDENT>for filename in filenames:<EOL><INDENT>pathfile = os.path.join(parent, filename)<EOL>arcname = pathfile[pre_len:].strip(os.path.sep);<EOL>zipf.write(pathfile, arcname)<EOL><DEDENT><DEDENT>zipf.close()<EOL>
Usage:
            p = r'D:\auto\env\ttest\ins\build\lib\rock4\softtest\support'
            mkzip(os.path.join(p, "appiumroot"),os.path.join(p, "appiumroot.zip"))
            unzip(os.path.join(p, "appiumroot.zip"),os.path.join(p, "appiumroot2"))