Created
December 4, 2020 15:32
-
-
Save shirou/7107634e4d75a6f594606fb263462283 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys | |
import os | |
import json | |
result = {"themes": []} | |
skip_themes = [ | |
"autorch-sphinx-theme", # no theme named 'pytorch_sphinx_theme' found (missing theme.conf?) | |
"djangochurch-docs-theme", # sphinx.errors.ThemeError: no theme named 'djangochurch_docs_theme' found | |
"dkist-sphinx-theme", # code missing from repo | |
"epfl-sphinx-theme", # code missing from repo | |
"sphinx-django-theme", # code missing from repo | |
"sphinx-funtoo-theme", # code missing from repo | |
"sphinx-guillotina-theme", # no theme named 'guillotina' found (missing theme.conf?) | |
"sphinx-idf-theme", # npm required | |
"sphinx-heigvd-theme", # No module named 'docutils' | |
"sphinx-md-theme", # TypeError: '>' not supported between instances of 'str' and 'int' | |
"sphinx-seeta-theme", # code missing from repo | |
"sphinx-target-theme", # code missing from repo | |
"sphinx-yellowblue-theme", # code missing from repo | |
"sphinx-typlog-theme", # jinja2.exceptions.UndefinedError: 'metatags' is undefined | |
"sphinxawesome-theme", # AttributeError: 'NoneType' object has no attribute 'replace' | |
"stsci-rtd-theme", # sphinx.errors.ThemeError: no theme named 'sphinx_rtd_theme' found, inherited by 'stsci_rtd_theme' | |
"torchexpo-sphinx-theme", # | |
] | |
def get(n: str) -> str: | |
if n in skip_themes: | |
return None | |
if n == "Maisie-Sphinx-Theme": | |
return { | |
"config": { | |
"_extensions": ["maisie_sphinx_theme"], | |
"_imports": ["maisie_sphinx_theme"], | |
"html_theme": "maisie_sphinx_theme", | |
"html_theme_path": "maisie_sphinx_theme.html_theme_path()", | |
}, | |
"display": n, | |
"pypi": n, | |
} | |
elif n == "autorch-sphinx-theme": | |
return { | |
"config": { | |
"_imports": ["autorch_sphinx_theme"], | |
"html_theme": "pytorch_sphinx_theme", | |
"html_theme_path": "autorch_sphinx_theme.get_html_theme_path()", | |
}, | |
"display": n, | |
"pypi": n, | |
} | |
elif n == "djangochurch-docs-theme": | |
return { | |
"config": { | |
"_imports": ["djangochurch_docs_theme"], | |
"html_theme": "djangochurch_docs_theme", | |
"html_theme_path": "djangochurch_docs_theme.get_html_theme_path()", | |
}, | |
"display": n, | |
"pypi": n, | |
} | |
elif n == "enthought-sphinx-theme": | |
return { | |
"config": { | |
"_imports": ["enthought_sphinx_theme"], | |
"html_theme": "enthought", | |
"html_theme_path": "[enthought_sphinx_theme.theme_path]", | |
}, | |
"display": n, | |
"pypi": n, | |
} | |
elif n == "limix-sphinx-theme": | |
return { | |
"config": { | |
"_imports": ["limix_sphinx_theme"], | |
"html_theme": "bootstrap-limix", | |
"html_theme_path": "limix_sphinx_theme.get_html_theme_path()", | |
}, | |
"display": n, | |
"pypi": n, | |
} | |
elif n == "rtcat-sphinx-theme": | |
return { | |
"config": { | |
"_imports": ["rtcat_sphinx_theme"], | |
"html_theme": "rtcat_sphinx_theme", | |
"html_theme_path": "[rtcat_sphinx_theme.get_html_theme_path()]", | |
}, | |
"display": n, | |
"pypi": n, | |
} | |
elif n == "faculty-sphinx-theme": | |
return { | |
"config": { | |
"_extensions": ["faculty_sphinx_theme"], | |
"html_theme": "faculty-sphinx-theme", | |
}, | |
"display": n, | |
"pypi": n, | |
} | |
elif n == "hachibee-sphinx-theme": | |
return { | |
"config": { | |
"_imports": ["hachibee_sphinx_theme"], | |
"html_theme": "hachibee", | |
"html_theme_path": "[hachibee_sphinx_theme.get_html_themes_path()]", | |
}, | |
"display": n, | |
"pypi": n, | |
} | |
elif n == "renga-sphinx-theme": | |
return { | |
"config": {"html_theme": "renga",}, | |
"display": n, | |
"pypi": n, | |
} | |
elif n == "rtcat_sphinx_theme": | |
return { | |
"config": { | |
"_imports": ["rtcat_sphinx_theme"], | |
"html_theme": "rtcat_sphinx_theme", | |
"html_theme_path": "[rtcat_sphinx_theme.get_html_theme_path()]", | |
}, | |
"display": n, | |
"pypi": n, | |
} | |
elif n == "sphinx-compas-theme": | |
return { | |
"config": { | |
"_imports": ["sphinx_compas_theme"], | |
"html_theme": "compas", | |
"html_theme_path": "sphinx_compas_theme.get_html_theme_path()", | |
}, | |
"display": n, | |
"pypi": n, | |
} | |
elif n == "sphinx-glpi-theme": | |
return { | |
"config": { | |
"_imports": ["sphinx_glpi_theme"], | |
"html_theme": "glpi", | |
"html_theme_path": "sphinx_glpi_theme.get_html_themes_path()", | |
}, | |
"display": n, | |
"pypi": n, | |
} | |
elif n == "sphinx-guillotina-theme": | |
return { | |
"config": {"html_theme": "guillotina",}, | |
"display": n, | |
"pypi": n, | |
} | |
elif n == "sphinx-heigvd-theme": | |
return { | |
"config": {"_imports": ["docutils"], "html_theme": "heigvd",}, | |
"display": n, | |
"pypi": n, | |
} | |
elif n == "sphinx-md-theme": | |
return { | |
"config": { | |
"_imports": ["sphinx_md_theme"], | |
"html_theme": "material_design", | |
"html_theme_path": "[sphinx_md_theme.get_path()]", | |
}, | |
"display": n, | |
"pypi": n, | |
} | |
elif n == "sphinx-nameko-theme": | |
return { | |
"config": { | |
"_imports": ["sphinx_nameko_theme"], | |
"html_theme": "nameko", | |
"html_theme_path": "[sphinx_nameko_theme.get_html_theme_path()]", | |
}, | |
"display": n, | |
"pypi": n, | |
} | |
elif n == "sphinx-pangeo-theme": | |
return { | |
"config": { | |
"_imports": ["sphinx_pangeo_theme"], | |
"html_theme": "pangeo", | |
"html_theme_path": "[sphinx_pangeo_theme.get_html_theme_path()]", | |
}, | |
"display": n, | |
"pypi": n, | |
} | |
elif n == "sphinx-readable-theme": | |
return { | |
"config": { | |
"_imports": ["sphinx_readable_theme"], | |
"html_theme": "readable", | |
"html_theme_path": "[sphinx_readable_theme.get_html_theme_path()]", | |
}, | |
"display": n, | |
"pypi": n, | |
} | |
elif n == "sphinx-theme-material": | |
return { | |
"config": {"html_theme": "material",}, | |
"display": n, | |
"pypi": n, | |
} | |
elif n == "sphinx-theme": | |
return { | |
"config": { | |
"_imports": ["sphinx_theme"], | |
"html_theme": "stanford_theme", | |
"html_theme_path": "[sphinx_theme.get_html_theme_path('stanford-theme')]", | |
}, | |
"display": n, | |
"pypi": n, | |
} | |
elif n == "sphinx-typlog-theme": | |
return { | |
"config": { | |
"_imports": ["sphinx_typlog_theme"], | |
"html_theme": "sphinx_typlog_theme", | |
"html_theme_path": "[sphinx_typlog_theme.get_path()]", | |
}, | |
"display": n, | |
"pypi": n, | |
} | |
elif n == "stanford-theme": | |
return { | |
"config": { | |
"_imports": ["stanford_theme"], | |
"html_theme": "stanford_theme", | |
"html_theme_path": "[stanford_theme.get_html_theme_path()]", | |
}, | |
"display": n, | |
"pypi": n, | |
} | |
elif n == "sphinxawesome-theme": | |
return { | |
"config": {"html_theme": "sphinxawesome_theme",}, | |
"display": n, | |
"pypi": n, | |
} | |
elif n == "stsci-rtd-theme": | |
return { | |
"config": { | |
"_imports": ["stsci_rtd_theme"], | |
"html_theme": "stsci_rtd_theme", | |
"html_theme_path": "[stsci_rtd_theme.get_html_theme_path()]", | |
}, | |
"display": n, | |
"pypi": n, | |
} | |
elif n == "torchexpo-sphinx-theme": | |
return { | |
"config": { | |
"_imports": ["stsci_rtd_theme"], | |
"html_theme": "stsci_rtd_theme", | |
"html_theme_path": "[stsci_rtd_theme.get_html_theme_path()]", | |
}, | |
"display": n, | |
"pypi": n, | |
} | |
else: | |
return { | |
"config": n.replace("-", "_"), | |
"display": n, | |
"pypi": n, | |
} | |
s = False | |
for line in sys.stdin: | |
n = line.strip() | |
j = get(n) | |
if j is None: | |
continue | |
result["themes"].append(j) | |
print(json.dumps(result)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment