def _win32_rmtree(path, verbose=<NUM_LIT:0>):
<EOL>def _rmjunctions(root):<EOL><INDENT>subdirs = []<EOL>for name in os.listdir(root):<EOL><INDENT>current = join(root, name)<EOL>if os.path.isdir(current):<EOL><INDENT>if _win32_is_junction(current):<EOL><INDENT>os.rmdir(current)<EOL><DEDENT>elif not os.path.islink(current):<EOL><INDENT>subdirs.append(current)<EOL><DEDENT><DEDENT><DEDENT>for subdir in subdirs:<EOL><INDENT>_rmjunctions(subdir)<EOL><DEDENT><DEDENT>if _win32_is_junction(path):<EOL><INDENT>if verbose:<EOL><INDENT>print('<STR_LIT>'.format(path))<EOL><DEDENT>os.rmdir(path)<EOL><DEDENT>else:<EOL><INDENT>if verbose:<EOL><INDENT>print('<STR_LIT>'.format(path))<EOL><DEDENT>_rmjunctions(path)<EOL>import shutil<EOL>shutil.rmtree(path)<EOL><DEDENT>
rmtree for win32 that treats junctions like directory symlinks.
The junction removal portion may not be safe on race conditions.

There is a known issue that prevents shutil.rmtree from
deleting directories with junctions.
https://bugs.python.org/issue31226