[issue40732] New realpath breaks setuptools_scm

Jason R. Coombs report at bugs.python.org
Fri May 22 16:25:18 EDT 2020


Jason R. Coombs <jaraco at jaraco.com> added the comment:

It's because on Unix:

```
>>> os.path.relpath('/Users/jaraco/code/main/path/.flake8', '')
'.flake8'
```

But on Windows, relpath raises an error for the comparable call:

```
>>> os.path.relpath('\\\\vmware-host\\shared folders\\home\\code\\main\\path\\.flake8', '')
ValueError: path is on mount '\\\\vmware-host\\shared folders', start on mount 'C:'
```

So it seems it may not be a bug in Python, but merely a consequence of Python 3.8 honoring symlinks in realpath, and exposing the unfortunate weakness of resolving relative real paths when root volumes aren't in a shared namespace.

Does Python have any advice for downstream users running into this or similar issues? If they want cross-platform compatibility, must they avoid use of realpath? Do you have any tips specific to what setuptools_scm is doing?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40732>
_______________________________________


More information about the Python-bugs-list mailing list