diff options
author | Christoph Reiter <reiter.christoph@gmail.com> | 2019-04-21 10:59:28 +0200 |
---|---|---|
committer | Christoph Reiter <reiter.christoph@gmail.com> | 2019-04-21 11:22:11 +0200 |
commit | c2d8dab8250d3cc6969fcabfd9f606ffe9c63823 (patch) | |
tree | d70b5fd4a892ddb773c81fa9e9473d084b29decd /giscanner/scannermain.py | |
parent | 7c2781c44a06b7e695dd225a106359208793c271 (diff) | |
download | gobject-introspection-c2d8dab8250d3cc6969fcabfd9f606ffe9c63823.tar.gz |
scanner: Fix error on Windows in case source files are on different drives
os.path.commonpath() raises ValueError if the paths given to it are on different
drives.
Handle that case by giving up and add a test.
Reported here: https://github.com/msys2/MINGW-packages/pull/5258#issuecomment-485230864
Diffstat (limited to 'giscanner/scannermain.py')
-rw-r--r-- | giscanner/scannermain.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/giscanner/scannermain.py b/giscanner/scannermain.py index c004fb19..4b723695 100644 --- a/giscanner/scannermain.py +++ b/giscanner/scannermain.py @@ -505,7 +505,12 @@ def get_source_root_dirs(options, filenames): if not dirs: return [] - common = os.path.commonpath(dirs) + try: + common = os.path.commonpath(dirs) + except ValueError: + # ValueError: On Windows in case the paths are on different drives + return dirs + # If the only common path is the root directory give up if os.path.dirname(common) == common: return dirs |