blob: 76c95200834f029458b7a3f9d79c0417e0465b60 [file] [log] [blame]
Matthew Bentham245d64c2019-12-02 12:59:43 +00001import os
2import tarfile
3
4import pyarmnn as ann
5import shutil
6
7from typing import List, Union
8
9from pdoc.cli import main
10
11
12def __copy_file_to_dir(file_paths: Union[List[str], str], target_dir_path: str):
13 file_paths = [] + file_paths
14
15 if not (os.path.exists(target_dir_path) and os.path.isdir(target_dir_path)):
16 os.makedirs(target_dir_path)
17
18 for file_path in file_paths:
19 if not (os.path.exists(file_path) and os.path.isfile(file_path)):
20 raise RuntimeError('Not a file: {}'.format(file_path))
21
22 file_name = os.path.basename(file_path)
23 shutil.copyfile(file_path, os.path.join(str(target_dir_path), file_name))
24
25
26def copy_doc_images():
27 __copy_file_to_dir(file_paths=['./images/pyarmnn.png' ],
28 target_dir_path='docs/pyarmnn/images')
29
30
31def archive_docs(path, version):
32
33 output_filename = f'pyarmnn_docs-{version}.tar'
34
35 with tarfile.open(output_filename, "w") as tar:
36 tar.add(path)
37
38
39if __name__ == "__main__":
40 with open('./readme.md', 'r') as readme_file:
41 top_level_pyarmnn_doc = ''.join(readme_file.readlines())
42 ann.__doc__ = top_level_pyarmnn_doc
43
44 main()
45
46 copy_doc_images()
47 archive_docs('./docs', ann.__version__)