aboutsummaryrefslogtreecommitdiff
path: root/python/pyarmnn/scripts
diff options
context:
space:
mode:
authorRichard Burton <richard.burton@arm.com>2020-04-08 16:39:05 +0100
committerJim Flynn <jim.flynn@arm.com>2020-04-10 16:11:09 +0000
commitdc0c6ed9f8b993e63f492f203d7d7080ab4c835c (patch)
treeea8541990b13ebf1a038009aa6b8b4b1ea8c3f55 /python/pyarmnn/scripts
parentfe5a24beeef6e9a41366e694f41093565e748048 (diff)
downloadarmnn-dc0c6ed9f8b993e63f492f203d7d7080ab4c835c.tar.gz
Add PyArmNN to work with ArmNN API of 20.02
* Add Swig rules for generating python wrapper * Add documentation * Add tests and testing data Change-Id: If48eda08931514fa21e72214dfead2835f07237c Signed-off-by: Richard Burton <richard.burton@arm.com> Signed-off-by: Derek Lamberti <derek.lamberti@arm.com>
Diffstat (limited to 'python/pyarmnn/scripts')
-rw-r--r--python/pyarmnn/scripts/generate_docs.py50
1 files changed, 50 insertions, 0 deletions
diff --git a/python/pyarmnn/scripts/generate_docs.py b/python/pyarmnn/scripts/generate_docs.py
new file mode 100644
index 0000000000..66eff6d52a
--- /dev/null
+++ b/python/pyarmnn/scripts/generate_docs.py
@@ -0,0 +1,50 @@
+# Copyright © 2020 Arm Ltd. All rights reserved.
+# SPDX-License-Identifier: MIT
+"""Generate PyArmNN documentation."""
+import os
+import tarfile
+
+import pyarmnn as ann
+import shutil
+
+from typing import List, Union
+
+from pdoc.cli import main
+
+
+def __copy_file_to_dir(file_paths: Union[List[str], str], target_dir_path: str):
+ file_paths = [] + file_paths
+
+ if not (os.path.exists(target_dir_path) and os.path.isdir(target_dir_path)):
+ os.makedirs(target_dir_path)
+
+ for file_path in file_paths:
+ if not (os.path.exists(file_path) and os.path.isfile(file_path)):
+ raise RuntimeError('Not a file: {}'.format(file_path))
+
+ file_name = os.path.basename(file_path)
+ shutil.copyfile(file_path, os.path.join(str(target_dir_path), file_name))
+
+
+def copy_doc_images():
+ __copy_file_to_dir(file_paths=['./images/pyarmnn.png'],
+ target_dir_path='docs/pyarmnn/images')
+
+
+def archive_docs(path, version):
+
+ output_filename = f'pyarmnn_docs-{version}.tar'
+
+ with tarfile.open(output_filename, "w") as tar:
+ tar.add(path)
+
+
+if __name__ == "__main__":
+ with open('./README.md', 'r') as readme_file:
+ top_level_pyarmnn_doc = ''.join(readme_file.readlines())
+ ann.__doc__ = top_level_pyarmnn_doc
+
+ main()
+
+ copy_doc_images()
+ archive_docs('./docs', ann.__version__)