summaryrefslogtreecommitdiff
path: root/python/python.go
diff options
context:
space:
mode:
author Raphael Blistein <raphy@google.com> 2024-05-08 16:15:53 +0000
committer Raphael Blistein <raphy@google.com> 2024-05-08 17:28:19 +0000
commit5985846f296fde6b0511643cc3049f8ac12d780a (patch)
tree8bd874577b3a9b2761ac1fd173318b3b17d7b777 /python/python.go
parentd02d71057082fa14e43d02bcead3d2999e3893c2 (diff)
relax the restriction on .proto files in data
Context: yaqs/7447701439926763520#a1 Bug: b/339454115 Test: go test Change-Id: If3ed81334a192993d32404301b55ca7b4f5780ae
Diffstat (limited to 'python/python.go')
-rw-r--r--python/python.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/python/python.go b/python/python.go
index e14fdf333..1ee533fa8 100644
--- a/python/python.go
+++ b/python/python.go
@@ -506,8 +506,8 @@ func (p *PythonLibraryModule) genModulePathMappings(ctx android.ModuleContext, p
}
for _, d := range expandedData {
- if d.Ext() == pyExt || d.Ext() == protoExt {
- ctx.PropertyErrorf("data", "found (.py|.proto) file: %q!", d.String())
+ if d.Ext() == pyExt {
+ ctx.PropertyErrorf("data", "found (.py) file: %q!", d.String())
continue
}
runfilesPath := filepath.Join(pkgPath, d.Rel())
@@ -523,19 +523,19 @@ func (p *PythonLibraryModule) createSrcsZip(ctx android.ModuleContext, pkgPath s
relativeRootMap := make(map[string]android.Paths)
var protoSrcs android.Paths
addPathMapping := func(path pathMapping) {
- // handle proto sources separately
- if path.src.Ext() == protoExt {
- protoSrcs = append(protoSrcs, path.src)
- } else {
- relativeRoot := strings.TrimSuffix(path.src.String(), path.src.Rel())
- relativeRootMap[relativeRoot] = append(relativeRootMap[relativeRoot], path.src)
- }
+ relativeRoot := strings.TrimSuffix(path.src.String(), path.src.Rel())
+ relativeRootMap[relativeRoot] = append(relativeRootMap[relativeRoot], path.src)
}
// "srcs" or "data" properties may contain filegroups so it might happen that
// the root directory for each source path is different.
for _, path := range p.srcsPathMappings {
- addPathMapping(path)
+ // handle proto sources separately
+ if path.src.Ext() == protoExt {
+ protoSrcs = append(protoSrcs, path.src)
+ } else {
+ addPathMapping(path)
+ }
}
for _, path := range p.dataPathMappings {
addPathMapping(path)