diff options
author | Nan Zhang <nanzhang@google.com> | 2017-12-01 20:00:31 +0000 |
---|---|---|
committer | Nan Zhang <nanzhang@google.com> | 2017-12-01 20:00:31 +0000 |
commit | d9ec5e7dea386f00594c43685eb25cdb6c0b6cba (patch) | |
tree | 8ebc182125ea5934c824a583c07b123ffa1010f7 /python/installer.go | |
parent | 0a32e5936b4c87bc705d06fa2d4f6fed1f58d602 (diff) | |
download | build_soong-d9ec5e7dea386f00594c43685eb25cdb6c0b6cba.tar.gz build_soong-d9ec5e7dea386f00594c43685eb25cdb6c0b6cba.tar.bz2 build_soong-d9ec5e7dea386f00594c43685eb25cdb6c0b6cba.zip |
Revert "Revert "Change Python in Soong to support device side build.""
This reverts commit 0a32e5936b4c87bc705d06fa2d4f6fed1f58d602.
Reason for revert: <libsqlite was missing for darwin_x86_64 before>
Change-Id: I2e13e849a503a705ffad425df292380f2f73954e
Diffstat (limited to 'python/installer.go')
-rw-r--r-- | python/installer.go | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/python/installer.go b/python/installer.go index 04698c55..ab3d9b4a 100644 --- a/python/installer.go +++ b/python/installer.go @@ -15,26 +15,47 @@ package python import ( + "path/filepath" + "android/soong/android" ) // This file handles installing python executables into their final location +type installLocation int + +const ( + InstallInData installLocation = iota +) + type pythonInstaller struct { - dir string + dir string + dir64 string + relative string path android.OutputPath } -func NewPythonInstaller(dir string) *pythonInstaller { +func NewPythonInstaller(dir, dir64 string) *pythonInstaller { return &pythonInstaller{ - dir: dir, + dir: dir, + dir64: dir64, } } var _ installer = (*pythonInstaller)(nil) +func (installer *pythonInstaller) installDir(ctx android.ModuleContext) android.OutputPath { + dir := installer.dir + if ctx.Arch().ArchType.Multilib == "lib64" && installer.dir64 != "" { + dir = installer.dir64 + } + if !ctx.Host() && !ctx.Arch().Native { + dir = filepath.Join(dir, ctx.Arch().ArchType.String()) + } + return android.PathForModuleInstall(ctx, dir, installer.relative) +} + func (installer *pythonInstaller) install(ctx android.ModuleContext, file android.Path) { - installer.path = ctx.InstallFile(android.PathForModuleInstall(ctx, installer.dir), - file.Base(), file) + installer.path = ctx.InstallFile(installer.installDir(ctx), file.Base(), file) } |