[gobject-introspection/paths.win] giscanner/girwriter.py: Fix running on Windows
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection/paths.win] giscanner/girwriter.py: Fix running on Windows
- Date: Thu, 6 Dec 2018 09:48:30 +0000 (UTC)
commit aaa7af50f98771efc8172c5dff7a898feda8c423
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Thu Dec 6 17:45:12 2018 +0800
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(-)
---
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]