@contextlib.contextmanager<EOL>def archive_context(filename):
tmpdir = tempfile.mkdtemp()<EOL>log.warn('<STR_LIT>', tmpdir)<EOL>old_wd = os.getcwd()<EOL>try:<EOL><INDENT>os.chdir(tmpdir)<EOL>with ContextualZipFile(filename) as archive:<EOL><INDENT>archive.extractall()<EOL><DEDENT>subdir = os.path.join(tmpdir, os.listdir(tmpdir)[<NUM_LIT:0>])<EOL>os.chdir(subdir)<EOL>log.warn('<STR_LIT>', subdir)<EOL>yield<EOL><DEDENT>finally:<EOL><INDENT>os.chdir(old_wd)<EOL>shutil.rmtree(tmpdir)<EOL><DEDENT>
Unzip filename to a temporary directory, set to the cwd.

The unzipped target is cleaned up after.