File tree Expand file tree Collapse file tree 2 files changed +18
-6
lines changed
Expand file tree Collapse file tree 2 files changed +18
-6
lines changed Original file line number Diff line number Diff line change 3737 set -e
3838 cd docs
3939 make html
40+ env :
41+ SPHINX_BUILD : " 1"
4042
4143 - name : Deploy to GitHub Pages
4244 run : |
Original file line number Diff line number Diff line change @@ -96,9 +96,19 @@ def load_cpp_module():
9696
9797
9898# Load the C++ module dynamically
99- _gbrl_cpp_module = load_cpp_module ()
100-
101- # Create a global alias for the GBRL class
102- GBRL_CPP = _gbrl_cpp_module .GBRL
103-
104- cuda_available = GBRL_CPP .cuda_available
99+ try :
100+ _gbrl_cpp_module = load_cpp_module ()
101+ # Create a global alias for the GBRL class
102+ GBRL_CPP = _gbrl_cpp_module .GBRL
103+ cuda_available = GBRL_CPP .cuda_available
104+ except ImportError :
105+ # If we're building documentation or the C++ module isn't available,
106+ # use a mock instead
107+ if os .environ .get ('SPHINX_BUILD' ) or 'sphinx' in sys .modules :
108+ from unittest .mock import MagicMock
109+ _gbrl_cpp_module = MagicMock ()
110+ GBRL_CPP = MagicMock ()
111+ cuda_available = lambda : False # noqa: E731
112+ else :
113+ # Re-raise the error if we're not building docs
114+ raise
You can’t perform that action at this time.
0 commit comments