diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 0000000000..58a307974f --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,52 @@ +# SPDX-FileCopyrightText: Contributors to the Fedora Project +# +# SPDX-License-Identifier: MIT + +# .readthedocs.yml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +# Build documentation in the docs/ directory with Sphinx +sphinx: + configuration: docs/conf.py + +# Set the version of Python and other tools you might need +build: + os: ubuntu-22.04 + tools: + python: "3.10" + apt_packages: + - libkrb5-dev + - python3-rpm + - python3-librepo + jobs: + # post_create_environment: + # # Install poetry + # # https://python-poetry.org/docs/#installing-manually + # - pip install poetry + # # Tell poetry to not use a virtual environment + # - poetry config virtualenvs.create false + post_install: + - pip install rpm + - python ./devel/import-into-venv librepo + - python -c "import bodhi.server" + - python -c "import bodhi.server.models" + # commands: + # - ./devel/ci/bodhi-ci docs -r pip + # - mv test_results/pip-docs/html/ $READTHEDOCS_OUTPUT/ + +python: + install: + - method: pip + path: ./bodhi-client + - method: pip + path: ./bodhi-messages + - method: pip + path: ./bodhi-server + +# Optionally build your docs in additional formats such as PDF and ePub +formats: + - htmlzip diff --git a/devel/import-into-venv b/devel/import-into-venv new file mode 100644 index 0000000000..984c29de65 --- /dev/null +++ b/devel/import-into-venv @@ -0,0 +1,38 @@ +#!/usr/bin/env python3 + +import os +import sys +import sysconfig +from pathlib import Path +from argparse import ArgumentParser +from collections import OrderedDict + + +SEARCH_PATHS = OrderedDict([ + ("platlib", Path(sysconfig.get_path("stdlib"))), + ("purelib", Path(sysconfig.get_path("stdlib").replace("lib64", "lib"))), # this is not pretty +]) + + +def main(): + parser = ArgumentParser() + parser.add_argument("module") + args = parser.parse_args() + + module_path = None + for path_name, search_path in SEARCH_PATHS.items(): + std_path = search_path.joinpath("site-packages") + module_path = std_path.joinpath(args.module) + if module_path.exists(): + break + if module_path is None: + print(f"Can't find module {args.module} in {' or '.join(SEARCH_PATHS.values())}", file=sys.stderr) + sys.exit(1) + + venv_path = Path(sysconfig.get_path(path_name)) + print(f"{module_path} -> {venv_path / args.module}") + os.symlink(module_path, venv_path.joinpath(args.module)) + + +if __name__ == "__main__": + main()