summaryrefslogtreecommitdiff
path: root/giscanner/girwriter.py
diff options
context:
space:
mode:
authorChun-wei Fan <fanchunwei@src.gnome.org>2018-12-06 17:45:12 +0800
committerChun-wei Fan <fanchunwei@src.gnome.org>2018-12-06 17:45:12 +0800
commitaaa7af50f98771efc8172c5dff7a898feda8c423 (patch)
treed5c6b94ab29b46c1dfed0afd468c3c3e77b002bb /giscanner/girwriter.py
parent33e0995a28a9b83522578e701147224bf04d9630 (diff)
downloadgobject-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/girwriter.py')
-rw-r--r--giscanner/girwriter.py9
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