1diff --git a/python/internal.bzl b/python/internal.bzl 2index d9ba37ef8..6596a2d39 100644 3--- a/python/internal.bzl 4+++ b/python/internal.bzl 5@@ -1,5 +1,11 @@ 6 # Internal helpers for building the Python protobuf runtime. 7 8+def _remove_cross_repo_path(path): 9+ components = path.split("/") 10+ if components[0] == "..": 11+ return "/".join(components[2:]) 12+ return path 13+ 14 def _internal_copy_files_impl(ctx): 15 strip_prefix = ctx.attr.strip_prefix 16 if strip_prefix[-1] != "/": 17@@ -7,10 +13,11 @@ def _internal_copy_files_impl(ctx): 18 19 src_dests = [] 20 for src in ctx.files.srcs: 21- if src.short_path[:len(strip_prefix)] != strip_prefix: 22+ short_path = _remove_cross_repo_path(src.short_path) 23+ if short_path[:len(strip_prefix)] != strip_prefix: 24 fail("Source does not start with %s: %s" % 25- (strip_prefix, src.short_path)) 26- dest = ctx.actions.declare_file(src.short_path[len(strip_prefix):]) 27+ (strip_prefix, short_path)) 28+ dest = ctx.actions.declare_file(short_path[len(strip_prefix):]) 29 src_dests.append([src, dest]) 30 31 if ctx.attr.is_windows: 32