Skip to content

Commit 6927241

Browse files
committed
fix shadow build with source and build dir on different Windows drives
Change-Id: Icf2f8bb7fc3e4e0631c619aa7dd092cc1ffd9152 Task-number: QTBUG-47686 Reviewed-by: Andras Becsi <[email protected]> Reviewed-by: Peter Varga <[email protected]>
1 parent 3052849 commit 6927241

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

chromium/third_party/WebKit/Source/bindings/scripts/compute_interfaces_info_individual.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,18 @@ def parse_options():
8383
# Computations
8484
################################################################################
8585

86+
def maybeRelativePath(path, start):
87+
if os.path.splitdrive(path)[0] == os.path.splitdrive(start)[0]:
88+
return os.path.relpath(path, start)
89+
return path
90+
8691
def relative_dir_posix(idl_filename):
87-
"""Returns relative path to the directory of idl_file in POSIX format."""
88-
relative_path_local = os.path.relpath(idl_filename, source_path)
92+
"""Returns relative path to the directory of idl_file in POSIX format.
93+
94+
On Windows, the absolute path to the directory is returned if source_path
95+
and idl_filename are on different drives.
96+
"""
97+
relative_path_local = maybeRelativePath(idl_filename, source_path)
8998
relative_dir_local = os.path.dirname(relative_path_local)
9099
return relative_dir_local.replace(os.path.sep, posixpath.sep)
91100

chromium/tools/grit/grit/grd_reader.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,11 @@ def ignorableWhitespace(self, whitespace):
138138
self.parent.ignorableWhitespace(whitespace)
139139

140140

141+
def maybeRelativePath(path, start):
142+
if os.path.splitdrive(path)[0] == os.path.splitdrive(start)[0]:
143+
return os.path.relpath(path, start)
144+
return path
145+
141146
def Parse(filename_or_stream, dir=None, stop_after=None, first_ids_file=None,
142147
debug=False, defines=None, tags_to_ignore=None, target_platform=None):
143148
'''Parses a GRD file into a tree of nodes (from grit.node).
@@ -207,7 +212,7 @@ def Parse(filename_or_stream, dir=None, stop_after=None, first_ids_file=None,
207212
GRIT_DIR_PREFIX = 'GRIT_DIR'
208213
if not (first_ids_file.startswith(GRIT_DIR_PREFIX)
209214
and first_ids_file[len(GRIT_DIR_PREFIX)] in ['/', '\\']):
210-
rel_dir = os.path.relpath(os.getcwd(), dir)
215+
rel_dir = maybeRelativePath(os.getcwd(), dir)
211216
first_ids_file = util.normpath(os.path.join(rel_dir, first_ids_file))
212217
handler.root.attrs['first_ids_file'] = first_ids_file
213218
# Assign first ids to the nodes that don't have them.

0 commit comments

Comments
 (0)