aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorNan Zhang <nanzhang@google.com>2017-11-08 21:20:04 -0800
committerNan Zhang <nanzhang@google.com>2017-11-08 21:25:40 -0800
commitea568a4a241dc3ab2e415143a698413106cb4c52 (patch)
treeab1bf9d248e1ff65144502581c2b7b0a7bb36ace /python
parent99a5635733d45b30e4b38770e52243f3c46dac1e (diff)
downloadbuild_soong-ea568a4a241dc3ab2e415143a698413106cb4c52.tar.gz
build_soong-ea568a4a241dc3ab2e415143a698413106cb4c52.tar.bz2
build_soong-ea568a4a241dc3ab2e415143a698413106cb4c52.zip
Change bool, and string properties to *bool, and *string for java,
python, and genrule. Test: m -j checkbuild Bug: b/68853585 Change-Id: Ic9a8083818e920dc399a4b00841e2aa496f70faa
Diffstat (limited to 'python')
-rw-r--r--python/binary.go16
-rw-r--r--python/python.go11
2 files changed, 15 insertions, 12 deletions
diff --git a/python/binary.go b/python/binary.go
index 95b0606e..14c49527 100644
--- a/python/binary.go
+++ b/python/binary.go
@@ -33,13 +33,13 @@ type BinaryProperties struct {
// this file must also be listed in srcs.
// If left unspecified, module name is used instead.
// If name doesn’t match any filename in srcs, main must be specified.
- Main string `android:"arch_variant"`
+ Main *string `android:"arch_variant"`
// set the name of the output binary.
- Stem string `android:"arch_variant"`
+ Stem *string `android:"arch_variant"`
// append to the name of the output binary.
- Suffix string `android:"arch_variant"`
+ Suffix *string `android:"arch_variant"`
// list of compatibility suites (for example "cts", "vts") that the module should be
// installed into.
@@ -179,10 +179,10 @@ func (binary *binaryDecorator) getHostInterpreterName(ctx android.ModuleContext,
func (binary *binaryDecorator) getPyMainFile(ctx android.ModuleContext,
srcsPathMappings []pathMapping) string {
var main string
- if binary.binaryProperties.Main == "" {
+ if String(binary.binaryProperties.Main) == "" {
main = ctx.ModuleName() + pyExt
} else {
- main = binary.binaryProperties.Main
+ main = String(binary.binaryProperties.Main)
}
for _, path := range srcsPathMappings {
@@ -197,11 +197,11 @@ func (binary *binaryDecorator) getPyMainFile(ctx android.ModuleContext,
func (binary *binaryDecorator) getStem(ctx android.ModuleContext) string {
stem := ctx.ModuleName()
- if binary.binaryProperties.Stem != "" {
- stem = binary.binaryProperties.Stem
+ if String(binary.binaryProperties.Stem) != "" {
+ stem = String(binary.binaryProperties.Stem)
}
- return stem + binary.binaryProperties.Suffix
+ return stem + String(binary.binaryProperties.Suffix)
}
// Sets the given directory and all its ancestor directories as Python packages.
diff --git a/python/python.go b/python/python.go
index 1b146a8e..9d6d6a79 100644
--- a/python/python.go
+++ b/python/python.go
@@ -65,7 +65,7 @@ type BaseProperties struct {
// (from a.b.c import ...) statement.
// if left unspecified, all the source/data files of current module are copied to
// "runfiles/" tree directory directly.
- Pkg_path string `android:"arch_variant"`
+ Pkg_path *string `android:"arch_variant"`
// true, if the Python module is used internally, eg, Python std libs.
Is_internal *bool `android:"arch_variant"`
@@ -367,14 +367,14 @@ func (p *Module) GeneratePythonBuildActions(ctx android.ModuleContext) {
expandedData := ctx.ExpandSources(p.properties.Data, nil)
// sanitize pkg_path.
- pkg_path := p.properties.Pkg_path
+ pkg_path := String(p.properties.Pkg_path)
if pkg_path != "" {
- pkg_path = filepath.Clean(p.properties.Pkg_path)
+ pkg_path = filepath.Clean(String(p.properties.Pkg_path))
if pkg_path == ".." || strings.HasPrefix(pkg_path, "../") ||
strings.HasPrefix(pkg_path, "/") {
ctx.PropertyErrorf("pkg_path",
"%q must be a relative path contained in par file.",
- p.properties.Pkg_path)
+ String(p.properties.Pkg_path))
return
}
if p.properties.Is_internal != nil && *p.properties.Is_internal {
@@ -557,3 +557,6 @@ func fillInMap(ctx android.ModuleContext, m map[string]string,
return true
}
+
+var Bool = proptools.Bool
+var String = proptools.String