view tests/readlink.py @ 26060:4ee2af2194d4

baseset: keep the input set around Baseset needs a list to operate, but will convert that list back to a set for membership testing. It seems a bit silly to convert the set into a list to convert it back afterward.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 20 Aug 2015 17:19:56 -0700
parents 328739ea70c3
children 7bcfb9090c86
line wrap: on
line source

#!/usr/bin/env python

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, 'not a symlink'

sys.exit(0)