diff options
author | Chun-wei Fan <fanchunwei@src.gnome.org> | 2018-12-06 17:45:12 +0800 |
---|---|---|
committer | Chun-wei Fan <fanchunwei@src.gnome.org> | 2018-12-06 17:45:12 +0800 |
commit | aaa7af50f98771efc8172c5dff7a898feda8c423 (patch) | |
tree | d5c6b94ab29b46c1dfed0afd468c3c3e77b002bb /giscanner | |
parent | 33e0995a28a9b83522578e701147224bf04d9630 (diff) | |
download | gobject-introspection-aaa7af50f98771efc8172c5dff7a898feda8c423.tar.gz |
giscanner/girwriter.py: Fix running on Windows
... When we are building in a drive that is different from the drive
that we are acquiring the depedencies from. For example,
os.path.relpath() does not like it when we we are building G-I on D:\foo
while the GLib headers are found are C:\glib.
Diffstat (limited to 'giscanner')
-rw-r--r-- | giscanner/girwriter.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/giscanner/girwriter.py b/giscanner/girwriter.py index 4f58229b..6bbb054d 100644 --- a/giscanner/girwriter.py +++ b/giscanner/girwriter.py @@ -127,7 +127,14 @@ class GIRWriter(XMLWriter): def _get_relative_path(self, filename): res = filename for root in self.sources_roots: - relpath = os.path.relpath(filename, root) + relpath = '' + try: + relpath = os.path.relpath(filename, root) + + # We might be on different drives on Windows, so relpath() won't work + except ValueError: + relpath = filename + if len(relpath) < len(res): res = relpath |