mehrdadh commented on a change in pull request #10555:
URL: https://github.com/apache/tvm/pull/10555#discussion_r825017718



##########
File path: docs/script_convert.py
##########
@@ -0,0 +1,75 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import argparse
+import pathlib
+
+BASH = "# bash"
+BASH_IGNORE = "# bash-ignore"
+BASH_MULTILINE_COMMENT_START = ": '"
+BASH_MULTILINE_COMMENT_END = "'"
+
+
+def convert(args: argparse.Namespace):
+    src_path = pathlib.Path(args.script)
+    des_path = src_path.parent / f"{src_path.stem}.py"
+    with open(src_path, "r") as src_f:
+        with open(des_path, "w") as des_f:
+            line = src_f.readline()
+            bash_block = []
+            bash_detected = False
+            bash_ignore_detected = False
+            while line:
+                line = line.strip("\n").strip("\r")
+                if bash_detected:
+                    if line == BASH:
+                        # write the bash block to destination
+                        python_code = "# .. code-block:: bash\n#\n"

Review comment:
       Is the idea to add the output of each command to generated python file 
and finally have it as part of generated HTML file?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to