Skip to content

Commit

Permalink
fix: allow failure when moonc is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-jerry-ye committed Dec 13, 2024
1 parent a7d8444 commit db1c59b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
17 changes: 12 additions & 5 deletions next/_ext/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,19 @@
logger = logging.getLogger(__name__)

def setup(app: Sphinx) -> ExtensionMetadata:
result = subprocess.run(["moonc", '-v'], capture_output=True)
if result.returncode != 0:
metadata = {
"version": "0.1.0",
"parallel_read_safe": True,
"parallel_write_safe": True,
}
try:
result = subprocess.run(["moonc", '-v'], capture_output=True, check=True)
except (FileNotFoundError, subprocess.CalledProcessError):
logger.warning("moonbit compiler is missing! No code check performed")
else:
logger.info(f"moonc version: {result.stdout.decode().strip()}")
app.connect("doctree-read", source_read_handler)
return metadata
logger.info(f"moonc version: {result.stdout.decode().strip()}")
app.connect("doctree-read", source_read_handler)
return metadata

class Visitor(NodeVisitor):
def visit_literal_block(self, node : Node):
Expand Down
4 changes: 3 additions & 1 deletion next/_ext/indent.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ def __init__(self, s, _):
def __radd__(self, _):
return f"```\n{self.s}\n```"

i18n.indent = ModifiedIndent
i18n.indent = ModifiedIndent

def setup(_app): pass
2 changes: 1 addition & 1 deletion next/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'sphinx_book_theme'
html_static_path = ['_static']
# html_static_path = ['_static']
html_theme_options = {
"repository_url": "https://github.com/moonbitlang/moonbit-docs/",
"path_to_docs": "next",
Expand Down

0 comments on commit db1c59b

Please sign in to comment.