1# Copyright (C) 2021 The Android Open Source Project 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 15import argparse 16from pathlib import Path 17 18def main(): 19 args_parser = argparse.ArgumentParser(description='Generate index for test apps') 20 args_parser.add_argument('--directory', help='Directory containing test apps') 21 args = args_parser.parse_args() 22 23 pathlist = Path(args.directory).rglob('*.apk') 24 file_names = [p.name for p in pathlist] 25 26 # TODO(scottjonathan): Replace this with a proto with actual details 27 with open(args.directory + "/index.txt", "w") as outfile: 28 for file_name in file_names: 29 print(file_name.rsplit(".", 1)[0], file=outfile) 30 31if __name__ == "__main__": 32 main()