util: add removedirs as platform depending function
According to fa901423ac23 introducing "windows._removedirs()":
If a hg repository including working directory is a reparse point
(directory symlinked or a junction point), then using
os.removedirs will remove the reparse point erroneously.
"windows._removedirs()" should be used instead of "os.removedirs()" on
Windows.
This patch adds "removedirs" as platform depending function to replace
"os.removedirs()" invocations for portability and safety
#!/usr/bin/env python
import errno, os, sys
for f in sys.argv[1:]:
try:
print f, '->', os.readlink(f)
except OSError, err:
if err.errno != errno.EINVAL:
raise
print f, 'not a symlink'
sys.exit(0)