Skip to content

Commit

Permalink
try fix rtd
Browse files Browse the repository at this point in the history
  • Loading branch information
bckohan committed Dec 20, 2023
1 parent 62dcbc6 commit fb18067
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ build:
post_create_environment:
- wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
- dpkg -x google-chrome-stable_current_amd64.deb $HOME/chrome
- export PATH=$PATH:$HOME/chrome/opt/google/chrome/
- export READTHEDOCS_BUILD=1
# Install poetry
# https://python-poetry.org/docs/#installing-manually
- pip install poetry
Expand Down
31 changes: 31 additions & 0 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,34 @@
todo_include_todos = True

latex_engine = 'xelatex'


@contextmanager
def typer_get_web_driver(directive):
import os

if not os.environ.get('READTHEDOCS_BUILD', None):
with sphinxcontrib_typer.typer_get_web_driver(directive) as driver:
yield driver
return

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager

# Set up headless browser options
options=Options()
options.binary_location = os.path.expanduser("~/chrome/opt/google/chrome/google-chrome")
options.add_argument("--headless")
options.add_argument("--no-sandbox")
options.add_argument("--disable-dev-shm-usage")
options.add_argument("--disable-gpu")
options.add_argument("--window-size=1920x1080")

driver = webdriver.Chrome(
service=Service(ChromeDriverManager().install()),
options=options
)
yield driver
driver.quit()

0 comments on commit fb18067

Please sign in to comment.