1# Copyright 2021 The TensorFlow Authors. 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"""Command line tool version of the extract_object_files module. 16 17This command line tool version takes the archive file path and the destination 18directory path as the positional command line arguments. 19""" 20 21import sys 22from typing import Sequence 23from tensorflow.lite.ios import extract_object_files 24 25 26def main(argv: Sequence[str]) -> None: 27 if len(argv) != 3: 28 raise RuntimeError('Usage: {} <archive_file> <dest_dir>'.format(argv[0])) 29 30 archive_path = argv[1] 31 dest_dir = argv[2] 32 with open(archive_path, 'rb') as archive_file: 33 extract_object_files.extract_object_files(archive_file, dest_dir) 34 35 36if __name__ == '__main__': 37 main(sys.argv) 38