1#
2# Copyright (C) 2017 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17from host_controller.build import build_provider
18
19
20class BuildProviderLocalFS(build_provider.BuildProvider):
21    """A build provider for local file system (fs)."""
22
23    def __init__(self):
24        super(BuildProviderLocalFS, self).__init__()
25
26    def Fetch(self, path, full_device_images=False):
27        """Fetches Android device artifact file(s) from a local path.
28
29        Args:
30            path: string, the path of the artifacts.
31
32        Returns:
33            a dict containing the device image info.
34            a dict containing the test suite package info.
35        """
36        if path.endswith(".tar.md5"):
37            self.SetDeviceImage("img", path)
38        else:
39            self.SetFetchedFile(path, full_device_images=full_device_images)
40        return self.GetDeviceImage(), self.GetTestSuitePackage()
41