Skip to content

Commit

Permalink
Fix schemas generation on RTD
Browse files Browse the repository at this point in the history
Signed-off-by: Mattia Verga <mattia.verga@tiscali.it>
  • Loading branch information
mattiaverga committed Nov 11, 2024
1 parent f07e238 commit 7ab6524
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,22 @@ build:
tools:
python: "3.10"
apt_packages:
- graphviz
- libkrb5-dev
- python3-pydot
- python3-rpm
- python3-librepo
jobs:
post_install:
- pip install rpm
- pip install sqlalchemy-schemadisplay rpm
- dpkg -L python3-librepo
- ln -s /usr/lib/python3/dist-packages/librepo $READTHEDOCS_VIRTUALENV_PATH/lib/python3.10/site-packages/librepo
- cp devel/development.ini.example bodhi-server/development.ini
- python -c "import bodhi.server.models"
pre_build:
- mkdir -p docs/generated
- python docs/generate_db_schema
- python docs/generate_json_schema
# commands:
# - ./devel/ci/bodhi-ci docs -r pip
# - mv test_results/pip-docs/html/ $READTHEDOCS_OUTPUT/
Expand Down
7 changes: 6 additions & 1 deletion docs/generate_db_schema
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"""
Generate an image of the database schema
"""
import os

from packaging import version
from sqlalchemy import create_engine
from sqlalchemy_schemadisplay import create_schema_graph
Expand All @@ -13,6 +15,9 @@ except ImportError:
from bodhi.server import models


DOCS_DIR = os.path.dirname(__file__)


def write_graph(filename):
if version.parse(sqlschemaver) >= version.parse('2.0'):
graph = create_schema_graph(
Expand All @@ -35,4 +40,4 @@ def write_graph(filename):


if __name__ == '__main__':
write_graph('generated/database.png')
write_graph(f'{DOCS_DIR}/generated/database.png')
1 change: 1 addition & 0 deletions news/PR5789.bug
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Bodhi documentation on RTD was missing some content generated by external scripts

0 comments on commit 7ab6524

Please sign in to comment.