From 90b5670bf1f4a2c82981c3c60928de880c830e00 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Fri, 4 Oct 2024 18:23:11 +0200 Subject: [PATCH] ci(pre-commit): Add more hooks and fix various code smells --- .codespellignore | 0 .github/workflows/build.yml | 1 - .pre-commit-config.yaml | 62 +++++++++++++++++++++++++++++---- .pre-commit/version_check.py | 27 ++++++++++++++ .sourceheaders.toml | 5 +++ README.md | 4 +-- docs/conf.py | 26 ++++++++++++++ docs/configuration.rst | 4 +-- pyproject.toml | 12 +++++++ sphinx_multiversion/__init__.py | 26 ++++++++++++++ sphinx_multiversion/__main__.py | 26 ++++++++++++++ sphinx_multiversion/git.py | 51 ++++++++++++++++++++++++++- sphinx_multiversion/main.py | 26 ++++++++++++++ sphinx_multiversion/sphinx.py | 26 ++++++++++++++ tests/__init__.py | 25 +++++++++++++ tests/test_sphinx.py | 27 ++++++++++++++ 16 files changed, 336 insertions(+), 12 deletions(-) create mode 100644 .codespellignore create mode 100644 .sourceheaders.toml diff --git a/.codespellignore b/.codespellignore new file mode 100644 index 00000000..e69de29b diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c379db42..0c96009d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -120,4 +120,3 @@ jobs: - name: Publish Distributions to PyPI uses: pypa/gh-action-pypi-publish@release/v1 - diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2ebdbdf2..7e2a902f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,17 +2,67 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.6.0 hooks: - - id: trailing-whitespace - - id: check-merge-conflict - - id: check-yaml - - id: check-executables-have-shebangs - - id: mixed-line-ending + - id: check-added-large-files + args: ["--maxkb=500"] + - id: check-ast + - id: check-byte-order-marker + - id: check-builtin-literals + - id: check-case-conflict + - id: check-docstring-first + - id: check-executables-have-shebangs + - id: check-json + - id: check-shebang-scripts-are-executable + - id: pretty-format-json + args: ["--autofix"] + - id: check-merge-conflict + - id: check-symlinks + - id: check-toml + - id: check-vcs-permalinks + - id: check-xml + - id: check-yaml + - id: debug-statements + - id: destroyed-symlinks + - id: detect-private-key + - id: end-of-file-fixer + - id: file-contents-sorter + - id: fix-byte-order-marker + - id: forbid-new-submodules + - id: mixed-line-ending + args: ["--fix=lf"] + - id: requirements-txt-fixer + - id: sort-simple-yaml + - id: trailing-whitespace - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.6.8 + rev: v0.6.9 hooks: - id: ruff args: [ --fix ] - id: ruff-format +- repo: https://github.com/codespell-project/codespell + rev: v2.3.0 + hooks: + - id: codespell + args: [ + --ignore-words=.codespellignore + ] +- repo: https://github.com/markdownlint/markdownlint + rev: v0.12.0 + hooks: + - id: markdownlint +- repo: https://github.com/Holzhaus/sourceheaders + rev: v0.0.4 + hooks: + - id: sourceheaders +- repo: https://github.com/PyCQA/bandit + rev: "1.7.10" + hooks: + - id: bandit + args: ["-c", "pyproject.toml", "--"] + additional_dependencies: ["bandit[toml]"] +- repo: https://github.com/gitleaks/gitleaks + rev: v8.20.0 + hooks: + - id: gitleaks - repo: local hooks: - id: version-check diff --git a/.pre-commit/version_check.py b/.pre-commit/version_check.py index 4c333180..49d2cd7d 100755 --- a/.pre-commit/version_check.py +++ b/.pre-commit/version_check.py @@ -1,4 +1,31 @@ #!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2024 Jan Holthuis +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +# SPDX-License-Identifier: BSD-2-Clause + import importlib.util import os import pkgutil diff --git a/.sourceheaders.toml b/.sourceheaders.toml new file mode 100644 index 00000000..e70475c9 --- /dev/null +++ b/.sourceheaders.toml @@ -0,0 +1,5 @@ +[general] +license = "BSD-2-Clause" +copyright_holder = "Jan Holthuis " +prefer_inline = true +width = 79 diff --git a/README.md b/README.md index 7a4940d6..0f2a27be 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ -# sphinx-multiversion [![License][license-badge]][license] [![Build Status][build-badge]][build] [![pre-commit.ci status][pre-commit-badge]][pre-commit] +# sphinx-multiversion [![License][license-badge]][license][![Build][build-badge]][build][![pre-commit.ci][pre-commit-badge]][pre-commit] Sphinx extension for building self-hosted versioned docs. This extension aims to provide a clean implementation that tries to avoid messing with Sphinx internals as much as possible. -Documentation can be found at: https://sphinx-contrib.github.io/multiversion/ +Documentation can be found at: [license]: https://github.com/sphinx-contrib/multiversion/blob/main/LICENSE [license-badge]: https://img.shields.io/github/license/sphinx-contrib/multiversion diff --git a/docs/conf.py b/docs/conf.py index bac4647f..69000602 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,4 +1,30 @@ # -*- coding: utf-8 -*- +# Copyright (c) 2024 Jan Holthuis +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +# SPDX-License-Identifier: BSD-2-Clause + """Sphinx configuration file.""" import time diff --git a/docs/configuration.rst b/docs/configuration.rst index 98ac8a16..e651c361 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -85,7 +85,7 @@ Here are some examples: Output Directory Format ======================= -Each version will be built into a seperate subdirectory of the Sphinx output directory. +Each version will be built into a separate subdirectory of the Sphinx output directory. The ``smv_outputdir_format`` setting determines the directory structure for the subdirectories. It is a new-style Python formatting string with two parameters - ``ref`` and ``config``. Here are some examples: @@ -113,7 +113,7 @@ You can override configuration variables the same way as you're used to with ``s Since ``sphinx-multiversion`` copies the branch data into a temporary directory and builds them there while leaving the current working directory unchanged, relative paths in your :file:`conf.py` will refer to the path of the version *you're building from*, not the path of the version you are trying to build documentation for. -Sometimes it might be necessary to override the configured path via a command line overide. +Sometimes it might be necessary to override the configured path via a command line argument. ``sphinx-multiversion`` allows you to insert placeholders into your override strings that will automatically be replaced with the correct value for the version you're building the documentation for. Here's an example for the `exhale extension `_: diff --git a/pyproject.toml b/pyproject.toml index 3bf3e2d4..85895c17 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,5 +38,17 @@ include = [ "/sphinx_multiversion", ] +[tool.bandit] +skips = [ + # Asserts are actually fine for checking the developer's assumptions, we + # "just" mustn't rely these assert in production code. + "B101", + # We need `subprocess` module. + "B404", + # As long as we don't use `shell=True` when spawning a subprocess, this + # should be fine. + "B603", +] + [tool.ruff] line-length = 79 diff --git a/sphinx_multiversion/__init__.py b/sphinx_multiversion/__init__.py index ce64e0c0..e7084ce2 100644 --- a/sphinx_multiversion/__init__.py +++ b/sphinx_multiversion/__init__.py @@ -1,4 +1,30 @@ # -*- coding: utf-8 -*- +# Copyright (c) 2024 Jan Holthuis +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +# SPDX-License-Identifier: BSD-2-Clause + from .sphinx import setup from .main import main diff --git a/sphinx_multiversion/__main__.py b/sphinx_multiversion/__main__.py index e506e1dd..066686e0 100755 --- a/sphinx_multiversion/__main__.py +++ b/sphinx_multiversion/__main__.py @@ -1,5 +1,31 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- +# Copyright (c) 2024 Jan Holthuis +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +# SPDX-License-Identifier: BSD-2-Clause + import sys from .main import main diff --git a/sphinx_multiversion/git.py b/sphinx_multiversion/git.py index 6ee52d8e..aede6128 100644 --- a/sphinx_multiversion/git.py +++ b/sphinx_multiversion/git.py @@ -1,4 +1,30 @@ # -*- coding: utf-8 -*- +# Copyright (c) 2024 Jan Holthuis +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +# SPDX-License-Identifier: BSD-2-Clause + import collections import datetime import logging @@ -153,6 +179,20 @@ def file_exists(gitroot, refname, filename): return proc.returncode == 0 +def filter_fs_traversal(member: tarfile.TarInfo): + """ + Returns false for all members that are absolute paths or use the parent + directory to protect against directory traversal attacks from malicious + tarfiles. + """ + return ( + not member.name.startswith("/") + and not member.name.startswith("\\") + and "../" not in member + and "..\\" not in member + ) + + def copy_tree(gitroot, src, dst, reference, sourcepath="."): with tempfile.SpooledTemporaryFile() as fp: cmd = ( @@ -167,4 +207,13 @@ def copy_tree(gitroot, src, dst, reference, sourcepath="."): subprocess.check_call(cmd, cwd=gitroot, stdout=fp) fp.seek(0) with tarfile.TarFile(fileobj=fp) as tarfp: - tarfp.extractall(dst) + # This should be safe, but still causes a warning with medium + # severity due to . + # Therefore we'll silence the warning. + tarfp.extractall( # nosec + dst, + members=[ + filter_fs_traversal(member) + for member in tarfp.getmembers() + ], + ) diff --git a/sphinx_multiversion/main.py b/sphinx_multiversion/main.py index 9870b314..a287aec4 100644 --- a/sphinx_multiversion/main.py +++ b/sphinx_multiversion/main.py @@ -1,4 +1,30 @@ # -*- coding: utf-8 -*- +# Copyright (c) 2024 Jan Holthuis +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +# SPDX-License-Identifier: BSD-2-Clause + import itertools import argparse import multiprocessing diff --git a/sphinx_multiversion/sphinx.py b/sphinx_multiversion/sphinx.py index 5a2edeb9..dbdbd92c 100644 --- a/sphinx_multiversion/sphinx.py +++ b/sphinx_multiversion/sphinx.py @@ -1,4 +1,30 @@ # -*- coding: utf-8 -*- +# Copyright (c) 2024 Jan Holthuis +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +# SPDX-License-Identifier: BSD-2-Clause + import datetime import json import collections diff --git a/tests/__init__.py b/tests/__init__.py index e69de29b..f2753547 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -0,0 +1,25 @@ +# Copyright (c) 2024 Jan Holthuis +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +# SPDX-License-Identifier: BSD-2-Clause diff --git a/tests/test_sphinx.py b/tests/test_sphinx.py index db38cb07..09a45968 100644 --- a/tests/test_sphinx.py +++ b/tests/test_sphinx.py @@ -1,3 +1,30 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2024 Jan Holthuis +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +# SPDX-License-Identifier: BSD-2-Clause + import os.path import posixpath import tempfile