summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
author Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2024-05-09 07:54:07 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2024-05-09 07:54:07 +0000
commitcfac8c1bc8f12abfb7bb83d05f5fa64d0b75c120 (patch)
tree47bd5b29231b13d9453550a7a87a119d52269b8a /python
parent29e34835460ea76d8fd304faf12db410825a6b92 (diff)
parent5985846f296fde6b0511643cc3049f8ac12d780a (diff)
Merge "relax the restriction on .proto files in data" into main
Diffstat (limited to 'python')
-rw-r--r--python/python.go20
-rw-r--r--python/python_test.go2
2 files changed, 11 insertions, 11 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)
diff --git a/python/python_test.go b/python/python_test.go
index c0b7295f9..6a6bd1d91 100644
--- a/python/python_test.go
+++ b/python/python_test.go
@@ -50,7 +50,7 @@ var (
" Second file: in module %s at path %q."
noSrcFileErr = moduleVariantErrTemplate + "doesn't have any source files!"
badSrcFileExtErr = moduleVariantErrTemplate + "srcs: found non (.py|.proto) file: %q!"
- badDataFileExtErr = moduleVariantErrTemplate + "data: found (.py|.proto) file: %q!"
+ badDataFileExtErr = moduleVariantErrTemplate + "data: found (.py) file: %q!"
bpFile = "Android.bp"
data = []struct {