[Python-ideas] os.path.cansymlink(path)

anatoly techtonik techtonik at gmail.com
Thu Jul 24 18:51:08 CEST 2014


This is a live code from current virtualenv.py:

    if hasattr(os, 'symlink'):
        logger.info('Symlinking Python bootstrap modules')

This code is wrong, because OS support for
symlinks doesn't guarantee that mounted filesystem
can do this, resulting in OSError at runtime. So, the
proper check would be to check if specific path
supports symlinking.

The idea is:

    os.path.cansymlink(path)  - Return True if filesystem
        of specified path can be symlinked.

Yes/No/Opinions?
-- 
anatoly t.


More information about the Python-ideas mailing list