| 94 | print(f"Unable to remove {f}") |
| 95 | |
| 96 | def generaterst(): |
| 97 | pythonrst = open("index.rst", "w") |
| 98 | pythonrst.write('''Binary Ninja Python API Reference |
| 99 | ===================================== |
| 100 | |
| 101 | Welcome to the Binary Ninja API documentation. The below methods are available |
| 102 | from the root of the `binaryninja` package, but most of the API is organized |
| 103 | into the modules shown in the left side-bar. |
| 104 | |
| 105 | These pages are intended as an API Reference. For a deeper explanation of how |
| 106 | different parts of Binary Ninja work, explanations of concepts, or if you're |
| 107 | new to Binary Ninja, you'll want to check out our `User Guide <https://docs.binary.ninja/>`_. |
| 108 | |
| 109 | If you're new to our API, we also have a `Developer Guide <https://docs.binary.ninja/dev/index.html>`_ |
| 110 | which covers many of the concepts developers should know. There's also a |
| 111 | `Cookbook <https://docs.binary.ninja/dev/cookbook.html>`_ which contains many |
| 112 | examples to get you started using our API. |
| 113 | |
| 114 | You can also scroll to the end to view a class list of all available classes. |
| 115 | |
| 116 | The search bar on the side works both online and offline. |
| 117 | |
| 118 | .. automodule:: binaryninja |
| 119 | :members: |
| 120 | :undoc-members: |
| 121 | :show-inheritance: |
| 122 | |
| 123 | Full Class List |
| 124 | *************** |
| 125 | |
| 126 | .. toctree:: |
| 127 | :maxdepth: 2 |
| 128 | |
| 129 | ''') |
| 130 | |
| 131 | # Generate docs for both binaryninja and binaryninja.debugger module |
| 132 | modules = modulelist(binaryninja) |
| 133 | modules.extend(modulelist(binaryninja.debugger, basename="debugger")) |
| 134 | if hasattr(binaryninja, "collaboration"): |
| 135 | modules.extend(modulelist(binaryninja.collaboration, basename="collaboration")) |
| 136 | modules = sorted(modules, key=lambda pair: pair[0]) |
| 137 | |
| 138 | for modulename, module in modules: |
| 139 | # Since we put debugger python files in a folder, binaryninja.{modulename} is no longer the |
| 140 | # correct name of the module |
| 141 | filename = f"{module.__name__}-module.rst" |
| 142 | spaces = " " * modulename.count(".") |
| 143 | # Dirty hack to skip polutting the main toc with nested modules |
| 144 | if modulename.count(".") == 0: |
| 145 | pythonrst.write(f" {spaces}{modulename} <{filename}>\n") |
| 146 | modulefile = open(filename, "w") |
| 147 | underline = "="*len(f"{modulename} module") |
| 148 | modulefile.write(f'''{modulename} module |
| 149 | {underline} |
| 150 | |
| 151 | .. autosummary:: |
| 152 | :toctree: |
| 153 | |