tests/readlink.py
author Yuya Nishihara <yuya@tcha.org>
Sat, 14 May 2016 19:46:18 +0900
changeset 29264 22625884b15c
parent 29175 7bcfb9090c86
child 29485 6a98f9408a50
permissions -rwxr-xr-x
revset: factor out reverse flag of sort() key Prepares for making a table of sort keys. This assumes 'k' has at least one character, which should be guaranteed by keys.split().

#!/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)