Skip to content

Commit 506e0f2

Browse files
authored
Merge pull request #105 from hugovk/rtd-preview
Previews in pull requests
2 parents 1d88b51 + 9a3e988 commit 506e0f2

File tree

2 files changed

+34
-12
lines changed

2 files changed

+34
-12
lines changed

.readthedocs.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Read the Docs configuration file
2+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3+
# Project page: https://readthedocs.org/projects/python-docs-theme-previews/
4+
5+
version: 2
6+
7+
build:
8+
os: ubuntu-22.04
9+
tools:
10+
python: "3"
11+
12+
commands:
13+
- git clone --depth=1 https://github.com/python/cpython
14+
- make html CPYTHON_PATH=cpython
15+
- mv cpython/Doc/build _readthedocs

Makefile

+19-12
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,29 @@
1-
CPYTHON_PATH = ../cpython
1+
# You can set these variables from the command line.
2+
CPYTHON_PATH = ../cpython
3+
PYTHON = python3
24
PACKAGE_ABS_PATH = $(shell pwd)/$(shell find dist/python-docs-theme-*.tar.gz)
35

46

5-
.PHONY: html
6-
html: venv
7-
cd $(CPYTHON_PATH)/Doc && \
8-
make html
9-
7+
.PHONY: help
8+
help:
9+
@echo "Please use \`make <target>' where <target> is one of"
10+
@echo " venv to create a venv with necessary tools at $(CPYTHON_PATH)/Doc/venv"
11+
@echo " html to make standalone CPython HTML files"
12+
@echo " htmlview to open the index page built by the html target in your browser"
1013

1114
.PHONY: venv
1215
venv:
13-
python3 -m build
16+
$(PYTHON) -m pip install build
17+
$(PYTHON) -m build
1418
cd $(CPYTHON_PATH)/Doc \
1519
&& make venv \
1620
&& ./venv/bin/pip install $(PACKAGE_ABS_PATH)
1721

18-
.PHONY: help
19-
help:
20-
@echo "html: default rule; run the \`venv\` rule, and also rebuild the CPython docs"
21-
@echo "venv: build the package, and install it into the virtual environment"
22-
@echo " at $(CPYTHON_PATH)/Doc/venv"
22+
.PHONY: html
23+
html: venv
24+
cd $(CPYTHON_PATH)/Doc && \
25+
make html
26+
27+
.PHONY: htmlview
28+
htmlview: html
29+
$(PYTHON) -c "import os, webbrowser; webbrowser.open('file://' + os.path.realpath('$(CPYTHON_PATH)/Doc/build/html/index.html'))"

0 commit comments

Comments
 (0)