view tests/readlink.py @ 50696:eb01d3a65ad8

library: enable runpy invocation on mercurial package
author Jason R. Coombs <jaraco@jaraco.com>
date Mon, 17 Apr 2023 09:38:52 -0400
parents 6000f5b25c9b
children
line wrap: on
line source

#!/usr/bin/env python3


import errno
import os
import 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)