tests/readlink.py
author Gregory Szorc <gregory.szorc@gmail.com>
Sun, 28 Jun 2015 12:28:48 -0700
changeset 25702 ab2c5163900e
parent 25660 328739ea70c3
child 29175 7bcfb9090c86
permissions -rwxr-xr-x
import-checker: establish new function for verifying import conventions A future patch will formalize the modern import convention. In preparation for that, introduce a new wrapper function that will invoke the proper function.

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