tests/readlink.py
author Pierre-Yves David <pierre-yves.david@octobus.net>
Fri, 26 Nov 2021 16:51:58 +0100
changeset 48406 c6d44457f7e3
parent 45849 c102b704edb5
child 48966 6000f5b25c9b
permissions -rwxr-xr-x
extensions: ignore "sub-options" when looking for extensions config suboptions are separated by ":" (see the path one for example). So we dont want to confuse these config with actual extensions. We don't have extensions sub option yet, but I am about to introduce one for making sure an extensions can load. So lets level the floor first. Differential Revision: https://phab.mercurial-scm.org/D11819

#!/usr/bin/env python3

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)