2016-07-10 10:18:24 +00:00
|
|
|
#!/usr/bin/env python
|
2016-07-06 16:51:32 +00:00
|
|
|
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
# For details: https://github.com/PyCQA/pylint/blob/master/COPYING
|
|
|
|
|
|
|
|
"""Script used to generate the features file before building the actual documentation."""
|
|
|
|
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
|
|
|
import sphinx
|
|
|
|
|
2016-07-10 10:18:24 +00:00
|
|
|
from pylint.lint import PyLinter
|
2016-07-06 16:51:32 +00:00
|
|
|
|
2019-03-09 10:22:36 +00:00
|
|
|
|
2016-07-06 16:51:32 +00:00
|
|
|
def builder_inited(app):
|
2016-07-10 10:18:24 +00:00
|
|
|
# PACKAGE/docs/exts/pylint_extensions.py --> PACKAGE/
|
|
|
|
base_path = os.path.dirname(
|
2019-03-09 10:23:15 +00:00
|
|
|
os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
)
|
2016-07-10 10:18:24 +00:00
|
|
|
linter = PyLinter()
|
|
|
|
linter.load_default_plugins()
|
2016-07-06 16:51:32 +00:00
|
|
|
|
2019-03-09 10:23:15 +00:00
|
|
|
features = os.path.join(base_path, "doc", "technical_reference", "features.rst")
|
|
|
|
with open(features, "w") as stream:
|
2016-07-10 10:18:24 +00:00
|
|
|
stream.write("Pylint features\n")
|
|
|
|
stream.write("===============\n\n")
|
|
|
|
stream.write(".. generated by pylint --full-documentation\n\n")
|
|
|
|
linter.print_full_documentation(stream)
|
2016-07-06 16:51:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
def setup(app):
|
2019-03-09 10:23:15 +00:00
|
|
|
app.connect("builder-inited", builder_inited)
|
|
|
|
return {"version": sphinx.__display_version__}
|
|
|
|
|
2016-07-10 10:18:24 +00:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
builder_inited(None)
|