Skip to content

Commit

Permalink
oops
Browse files Browse the repository at this point in the history
  • Loading branch information
bkietz committed Nov 4, 2024
1 parent 9c5c219 commit b90cb44
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
2 changes: 2 additions & 0 deletions bootstrapping.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@ if(
message(FATAL_ERROR "try_compile failed: ${errors}")
endif()
endif()

_maud_set(_MAUD_IN2 "ERROR_PLACEHOLDER_MAUD_IN2_NOT_BOOTSTRAPPED")
5 changes: 3 additions & 2 deletions cmake_modules/Maud.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1071,7 +1071,6 @@ endfunction()

function(_maud_setup_doc)
find_package(Python3)

if(NOT TARGET Python3::Interpreter)
# TODO instead, error here (but include instructions to disable doc)
message(VERBOSE "Could not find Python3, abandoning doc")
Expand Down Expand Up @@ -1123,13 +1122,15 @@ function(_maud_setup_doc)
dependencies = []
]]
)
file(WRITE "${MAUD_DIR}/maud_sphinx_adapter/maud/cache/__init__.py")
file(
WRITE "${MAUD_DIR}/maud_sphinx_adapter/maud/__init__.py"
"import sys\n"
"sys.path.append('${_MAUD_SELF_DIR}')\n"
"from _maud_sphinx_adapter import setup, read_cache\n"
"sys.path = sys.path[:-1]\n"
"cache = read_cache('${CMAKE_BINARY_DIR}')\n"
"import maud.cache\n"
"read_cache('${CMAKE_BINARY_DIR}', maud.cache)\n"
)

message(STATUS "Building virtual env ${doc}/venv for Sphinx")
Expand Down
6 changes: 1 addition & 5 deletions cmake_modules/_maud_sphinx_adapter.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
from pathlib import Path
import re

def read_cache(build_dir: str):
class cache:
pass

def read_cache(build_dir: str, cache):
ENTRY = re.compile("([^#/].*):(.+)=(.*)")
FALSE_STRINGS = {""} | set("0 FALSE OFF N NO IGNORE NOTFOUND".split())
INTERNAL_PATHS = set("CMAKE_SOURCE_DIR CMAKE_BINARY_DIR MAUD_DIR".split())
Expand All @@ -20,7 +17,6 @@ class cache:
value = Path(value)

setattr(cache, name, value)
return cache


def setup(app):
Expand Down
2 changes: 1 addition & 1 deletion install.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ install(
"${dir}/cmake_modules/test_.cxx"
"${dir}/cmake_modules/test_.hxx"
"${dir}/cmake_modules/test_main_.cxx"
"${dir}/cmake_modules/.maud_sphinx_cmake_adapter.py.in2"
"${dir}/cmake_modules/_maud_sphinx_adapter.py"
"${dir}/cmake_modules/sphinx_requirements.txt"
DESTINATION
"${CMAKE_INSTALL_LIBDIR}/cmake/Maud"
Expand Down
2 changes: 1 addition & 1 deletion project.test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ documentation:
)
- write: sphinx_configuration/conf.py
contents: |
from maud import SOME_DOC_OPTION, BUILD_TESTING, CMAKE_SOURCE_DIR
from maud.cache import SOME_DOC_OPTION, BUILD_TESTING, CMAKE_SOURCE_DIR
extensions = ['maud', 'trike']
assert SOME_DOC_OPTION == 'B'
assert type(BUILD_TESTING) == bool
Expand Down

0 comments on commit b90cb44

Please sign in to comment.