From aaa7af50f98771efc8172c5dff7a898feda8c423 Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Thu, 6 Dec 2018 17:45:12 +0800 Subject: 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. --- giscanner/girwriter.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'giscanner/girwriter.py') 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 -- cgit v1.2.1