| Nan Zhang | 5323f8e | 2017-05-10 13:37:54 -0700 | [diff] [blame] | 1 | // Copyright 2017 Google Inc. All rights reserved. | 
|  | 2 | // | 
|  | 3 | // Licensed under the Apache License, Version 2.0 (the "License"); | 
|  | 4 | // you may not use this file except in compliance with the License. | 
|  | 5 | // You may obtain a copy of the License at | 
|  | 6 | // | 
|  | 7 | //     http://www.apache.org/licenses/LICENSE-2.0 | 
|  | 8 | // | 
|  | 9 | // Unless required by applicable law or agreed to in writing, software | 
|  | 10 | // distributed under the License is distributed on an "AS IS" BASIS, | 
|  | 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
|  | 12 | // See the License for the specific language governing permissions and | 
|  | 13 | // limitations under the License. | 
|  | 14 |  | 
|  | 15 | package python | 
|  | 16 |  | 
|  | 17 | import ( | 
|  | 18 | "android/soong/android" | 
|  | 19 | ) | 
|  | 20 |  | 
|  | 21 | // This file handles installing python executables into their final location | 
|  | 22 |  | 
|  | 23 | type pythonInstaller struct { | 
|  | 24 | dir string | 
|  | 25 |  | 
|  | 26 | path android.OutputPath | 
|  | 27 | } | 
|  | 28 |  | 
|  | 29 | func NewPythonInstaller(dir string) *pythonInstaller { | 
|  | 30 | return &pythonInstaller{ | 
|  | 31 | dir: dir, | 
|  | 32 | } | 
|  | 33 | } | 
|  | 34 |  | 
|  | 35 | var _ installer = (*pythonInstaller)(nil) | 
|  | 36 |  | 
|  | 37 | func (installer *pythonInstaller) install(ctx android.ModuleContext, file android.Path) { | 
| Colin Cross | 5c51792 | 2017-08-31 12:29:17 -0700 | [diff] [blame] | 38 | installer.path = ctx.InstallFile(android.PathForModuleInstall(ctx, installer.dir), | 
|  | 39 | file.Base(), file) | 
| Nan Zhang | 5323f8e | 2017-05-10 13:37:54 -0700 | [diff] [blame] | 40 | } |