tests/readlink.py
author Denis Laxalde <denis.laxalde@logilab.fr>
Fri, 03 Jun 2016 15:55:07 +0200
changeset 29283 14eee72c8d52
parent 29175 7bcfb9090c86
child 29485 6a98f9408a50
permissions -rwxr-xr-x
revert: use "discard"/"revert" verb when reverting interactively (issue5143) Instead of "record this change to 'FILE'?" now prompt with: * "discard this change to 'FILE'?" when reverting to the parent of working directory, and, * "revert this change to 'FILE'?" otherwise.

#!/usr/bin/env python

from __future__ import print_function

import errno, os, sys

for f in sys.argv[1:]:
    try:
        print(f, '->', os.readlink(f))
    except OSError as err:
        if err.errno != errno.EINVAL:
            raise
        print(f, '->', f, 'not a symlink')

sys.exit(0)