|
1 | 1 | #!/usr/bin/python3 |
2 | | -## Copyright (c) 2019-2020 Advanced Micro Devices, Inc. All rights reserved. |
| 2 | +## Copyright (c) 2019-2023 Advanced Micro Devices, Inc. All rights reserved. |
3 | 3 | # GPA Packaging script |
4 | 4 |
|
5 | 5 | import os |
@@ -76,9 +76,6 @@ def CreatePackage(self, archive_output_dir, build_artifacts_dir, sphinx_docs_dir |
76 | 76 | gpa_build_artifacts_dir = self._gpa_build_artifacts_dir |
77 | 77 | gpa_archive_out_dir = self._gpa_build_artifacts_dir |
78 | 78 |
|
79 | | - if sphinx_docs_dir is None: |
80 | | - sphinx_docs_dir = self._gpa_build_artifacts_dir |
81 | | - |
82 | 79 | config_str = "release" |
83 | 80 | if is_debug == True: |
84 | 81 | config_str = "debug" |
@@ -172,25 +169,31 @@ def CreatePackage(self, archive_output_dir, build_artifacts_dir, sphinx_docs_dir |
172 | 169 | GpaUtils.WriteFileToArchive(gpa_archive_handle, other_file_abs_path, |
173 | 170 | other_file_in_archive) |
174 | 171 |
|
175 | | - # Write docs |
176 | | - gpa_docs_dir = os.path.normpath(os.path.join(gpa_build_artifacts_dir, sphinx_docs_dir, "html")) |
177 | | - gpa_docs_dir_str = str(gpa_docs_dir) |
178 | | - gpa_docs_dir_info = os.walk(gpa_docs_dir) |
| 172 | + if (sphinx_docs_dir is not None) and (sphinx_docs_dir != ""): |
| 173 | + # Write docs |
| 174 | + gpa_docs_dir = os.path.normpath(os.path.join(gpa_build_artifacts_dir, sphinx_docs_dir, "html")) |
| 175 | + gpa_docs_dir_str = str(gpa_docs_dir) |
| 176 | + gpa_docs_dir_info = os.walk(gpa_docs_dir) |
179 | 177 |
|
180 | | - if sys.platform == "win32": |
181 | | - doc_folder_str = "\\docs" |
182 | | - else: |
183 | | - doc_folder_str = "/docs" |
184 | | - |
185 | | - for dirs, sub_dirs, files in gpa_docs_dir_info: |
186 | | - for file in files: |
187 | | - doc_file_abs_path = os.path.join(dirs, file) |
188 | | - doc_file_abs_path = os.path.normpath(doc_file_abs_path) |
189 | | - doc_file_abs_path_str = str(doc_file_abs_path) |
190 | | - doc_file_in_archive = gpa_archive_root_name + doc_folder_str + \ |
191 | | - doc_file_abs_path_str.split(gpa_docs_dir_str)[1] |
192 | | - GpaUtils.WriteFileToArchive(gpa_archive_handle, doc_file_abs_path, |
193 | | - doc_file_in_archive) |
| 178 | + if sys.platform == "win32": |
| 179 | + doc_folder_str = "\\docs" |
| 180 | + else: |
| 181 | + doc_folder_str = "/docs" |
| 182 | + |
| 183 | + file_count = 0 |
| 184 | + for dirs, sub_dirs, files in gpa_docs_dir_info: |
| 185 | + for file in files: |
| 186 | + file_count = file_count + 1 |
| 187 | + doc_file_abs_path = os.path.join(dirs, file) |
| 188 | + doc_file_abs_path = os.path.normpath(doc_file_abs_path) |
| 189 | + doc_file_abs_path_str = str(doc_file_abs_path) |
| 190 | + doc_file_in_archive = gpa_archive_root_name + doc_folder_str + \ |
| 191 | + doc_file_abs_path_str.split(gpa_docs_dir_str)[1] |
| 192 | + GpaUtils.WriteFileToArchive(gpa_archive_handle, doc_file_abs_path, |
| 193 | + doc_file_in_archive) |
| 194 | + |
| 195 | + if file_count == 0: |
| 196 | + raise Exception("Failed to find html documentation") |
194 | 197 |
|
195 | 198 | # Returns the gpa version |
196 | 199 | def GetGpaVersion(self, _build_numberin): |
|
0 commit comments