tests/readlink.py
author Raphaël Gomès <rgomes@octobus.net>
Sun, 06 Sep 2020 10:33:12 +0200
changeset 45517 2a68a5ec8dd0
parent 29485 6a98f9408a50
child 45830 c102b704edb5
permissions -rwxr-xr-x
rust-cpython: switch logging facade from `simple_logger` to `env_logger` `simple_logger` is just too simple. `env_logger` supports logging to `stderr`, and logging filtering, for example, which are becoming necessary now. The project is nicely active. Differential Revision: https://phab.mercurial-scm.org/D8990

#!/usr/bin/env python

from __future__ import absolute_import, print_function

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)