Skip to content

Commit 7700840

Browse files
authored
Merge pull request #7016 from hugovk/docs-replace-sphinx-issues
Docs: Replace dependency sphinx-issues with builtin sphinx.ext.extlinks
2 parents adae44d + 3a262f0 commit 7700840

File tree

22 files changed

+89
-54
lines changed

22 files changed

+89
-54
lines changed

.github/workflows/docs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ concurrency:
1818
group: ${{ github.workflow }}-${{ github.ref }}
1919
cancel-in-progress: true
2020

21+
env:
22+
FORCE_COLOR: 1
23+
2124
jobs:
2225
build:
2326

Makefile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,16 @@ coverage:
1616
python3 -m coverage report
1717

1818
.PHONY: doc
19-
doc:
19+
.PHONY: html
20+
doc html:
2021
python3 -c "import PIL" > /dev/null 2>&1 || python3 -m pip install .
2122
$(MAKE) -C docs html
2223

24+
.PHONY: htmlview
25+
htmlview:
26+
python3 -c "import PIL" > /dev/null 2>&1 || python3 -m pip install .
27+
$(MAKE) -C docs htmlview
28+
2329
.PHONY: doccheck
2430
doccheck:
2531
$(MAKE) doc
@@ -38,7 +44,8 @@ help:
3844
@echo " coverage run coverage test (in progress)"
3945
@echo " doc make HTML docs"
4046
@echo " docserve run an HTTP server on the docs directory"
41-
@echo " html to make standalone HTML files"
47+
@echo " html make HTML docs"
48+
@echo " htmlview open the index page built by the html target in your browser"
4249
@echo " inplace make inplace extension"
4350
@echo " install make and install"
4451
@echo " install-coverage make and install with C coverage"

docs/Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
1919
help:
2020
@echo "Please use \`make <target>' where <target> is one of"
2121
@echo " html to make standalone HTML files"
22+
@echo " htmlview to open the index page built by the html target in your browser"
2223
@echo " serve to start a local server for viewing docs"
2324
@echo " livehtml to start a local server for viewing docs and auto-reload on change"
2425
@echo " dirhtml to make HTML files named index.html in directories"
@@ -45,7 +46,7 @@ clean:
4546
-rm -rf $(BUILDDIR)/*
4647

4748
install-sphinx:
48-
$(PYTHON) -m pip install --quiet furo olefile sphinx sphinx-copybutton sphinx-inline-tabs sphinx-issues sphinx-removed-in sphinxext-opengraph
49+
$(PYTHON) -m pip install --quiet furo olefile sphinx sphinx-copybutton sphinx-inline-tabs sphinx-removed-in sphinxext-opengraph
4950

5051
.PHONY: html
5152
html:
@@ -196,6 +197,10 @@ doctest:
196197
@echo "Testing of doctests in the sources finished, look at the " \
197198
"results in $(BUILDDIR)/doctest/output.txt."
198199

200+
.PHONY: htmlview
201+
htmlview: html
202+
$(PYTHON) -c "import os, webbrowser; webbrowser.open('file://' + os.path.realpath('$(BUILDDIR)/html/index.html'))"
203+
199204
.PHONY: livehtml
200205
livehtml: html
201206
livereload $(BUILDDIR)/html -p 33233

docs/conf.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@
2828
# ones.
2929
extensions = [
3030
"sphinx.ext.autodoc",
31+
"sphinx.ext.extlinks",
3132
"sphinx.ext.intersphinx",
3233
"sphinx.ext.viewcode",
3334
"sphinx_copybutton",
3435
"sphinx_inline_tabs",
35-
"sphinx_issues",
3636
"sphinx_removed_in",
3737
"sphinxext.opengraph",
3838
]
@@ -317,8 +317,17 @@ def setup(app):
317317
app.add_css_file("css/dark.css")
318318

319319

320-
# GitHub repo for sphinx-issues
321-
issues_github_path = "python-pillow/Pillow"
320+
# sphinx.ext.extlinks
321+
# This config is a dictionary of external sites,
322+
# mapping unique short aliases to a base URL and a prefix.
323+
# https://www.sphinx-doc.org/en/master/usage/extensions/extlinks.html
324+
_repo = "https://github.com/python-pillow/Pillow/"
325+
extlinks = {
326+
"cve": ("https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-%s", "CVE-%s"),
327+
"cwe": ("https://cwe.mitre.org/data/definitions/%s.html", "CWE-%s"),
328+
"issue": (_repo + "issues/%s", "#%s"),
329+
"pr": (_repo + "pull/%s", "#%s"),
330+
}
322331

323332
# sphinxext.opengraph
324333
ogp_image = (

docs/deprecations.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ FreeType 2.7
261261
Support for FreeType 2.7 has been removed.
262262

263263
We recommend upgrading to at least `FreeType`_ 2.10.4, which fixed a severe
264-
vulnerability introduced in FreeType 2.6 (:cve:`CVE-2020-15999`).
264+
vulnerability introduced in FreeType 2.6 (:cve:`2020-15999`).
265265

266266
.. _FreeType: https://freetype.org/
267267

docs/make.bat

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ if "%1" == "help" (
1919
:help
2020
echo.Please use `make ^<target^>` where ^<target^> is one of
2121
echo. html to make standalone HTML files
22+
echo. htmlview to open the index page built by the html target in your browser
2223
echo. dirhtml to make HTML files named index.html in directories
2324
echo. singlehtml to make a single large HTML file
2425
echo. pickle to make pickle files
@@ -44,12 +45,23 @@ if "%1" == "clean" (
4445
goto end
4546
)
4647

47-
if "%1" == "html" (
48+
set html=false
49+
if "%1%" == "html" set html=true
50+
if "%1%" == "htmlview" set html=true
51+
if "%html%" == "true" (
4852
%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
4953
if errorlevel 1 exit /b 1
5054
echo.
5155
echo.Build finished. The HTML pages are in %BUILDDIR%/html.
52-
goto end
56+
57+
if "%1" == "htmlview" (
58+
if EXIST "%BUILDDIR%\html\index.html" (
59+
echo.Opening "%BUILDDIR%\html\index.html" in the default web browser...
60+
start "" "%BUILDDIR%\html\index.html"
61+
)
62+
)
63+
64+
goto end
5365
)
5466

5567
if "%1" == "dirhtml" (

docs/releasenotes/3.1.1.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ CVE-2016-0740 -- Buffer overflow in TiffDecode.c
66
------------------------------------------------
77

88
Pillow 3.1.0 and earlier when linked against libtiff >= 4.0.0 on x64
9-
may overflow a buffer when reading a specially crafted tiff file (:cve:`CVE-2016-0740`).
9+
may overflow a buffer when reading a specially crafted tiff file (:cve:`2016-0740`).
1010

1111
Specifically, libtiff >= 4.0.0 changed the return type of
1212
``TIFFScanlineSize`` from ``int32`` to machine dependent
@@ -24,7 +24,7 @@ CVE-2016-0775 -- Buffer overflow in FliDecode.c
2424
-----------------------------------------------
2525

2626
In all versions of Pillow, dating back at least to the last PIL 1.1.7
27-
release, FliDecode.c has a buffer overflow error (:cve:`CVE-2016-0775`).
27+
release, FliDecode.c has a buffer overflow error (:cve:`2016-0775`).
2828

2929
Around line 192:
3030

@@ -53,7 +53,7 @@ CVE-2016-2533 -- Buffer overflow in PcdDecode.c
5353
-----------------------------------------------
5454

5555
In all versions of Pillow, dating back at least to the last PIL 1.1.7
56-
release, ``PcdDecode.c`` has a buffer overflow error (:cve:`CVE-2016-2533`).
56+
release, ``PcdDecode.c`` has a buffer overflow error (:cve:`2016-2533`).
5757

5858
The ``state.buffer`` for ``PcdDecode.c`` is allocated based on a 3
5959
bytes per pixel sizing, where ``PcdDecode.c`` wrote into the buffer

docs/releasenotes/3.1.2.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ CVE-2016-3076 -- Buffer overflow in Jpeg2KEncode.c
77

88
Pillow between 2.5.0 and 3.1.1 may overflow a buffer when writing
99
large Jpeg2000 files, allowing for code execution or other memory
10-
corruption (:cve:`CVE-2016-3076`).
10+
corruption (:cve:`2016-3076`).
1111

1212
This occurs specifically in the function ``j2k_encode_entry``, at the line:
1313

docs/releasenotes/6.2.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Security
6969
========
7070

7171
This release catches several buffer overruns, as well as addressing
72-
:cve:`CVE-2019-16865`. The CVE is regarding DOS problems, such as consuming large
72+
:cve:`2019-16865`. The CVE is regarding DOS problems, such as consuming large
7373
amounts of memory, or taking a large amount of time to process an image.
7474

7575
In RawDecode.c, an error is now thrown if skip is calculated to be less than

docs/releasenotes/6.2.2.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ Security
66

77
This release addresses several security problems.
88

9-
:cve:`CVE-2019-19911` is regarding FPX images. If an image reports that it has a large
9+
:cve:`2019-19911` is regarding FPX images. If an image reports that it has a large
1010
number of bands, a large amount of resources will be used when trying to process the
1111
image. This is fixed by limiting the number of bands to those usable by Pillow.
1212

13-
Buffer overruns were found when processing an SGI (:cve:`CVE-2020-5311`),
14-
PCX (:cve:`CVE-2020-5312`) or FLI image (:cve:`CVE-2020-5313`). Checks have been added
13+
Buffer overruns were found when processing an SGI (:cve:`2020-5311`),
14+
PCX (:cve:`2020-5312`) or FLI image (:cve:`2020-5313`). Checks have been added
1515
to prevent this.
1616

17-
:cve:`CVE-2020-5310`: Overflow checks have been added when calculating the size of a
17+
:cve:`2020-5310`: Overflow checks have been added when calculating the size of a
1818
memory block to be reallocated in the processing of a TIFF image.

0 commit comments

Comments
 (0)