From 1bea10190ba4082953bf8a7907a5dd057677621b Mon Sep 17 00:00:00 2001 From: Loup-Garou911XD Date: Wed, 6 Mar 2024 00:55:49 +0530 Subject: [PATCH 01/24] modified: Makefile new file: src/assets/sphinx/template/Makefile new file: src/assets/sphinx/template/conf.py new file: src/assets/sphinx/template/index.rst new file: src/assets/sphinx/template/make.bat --- Makefile | 5 +++ src/assets/sphinx/template/Makefile | 20 +++++++++ src/assets/sphinx/template/conf.py | 61 ++++++++++++++++++++++++++++ src/assets/sphinx/template/index.rst | 20 +++++++++ src/assets/sphinx/template/make.bat | 35 ++++++++++++++++ 5 files changed, 141 insertions(+) create mode 100644 src/assets/sphinx/template/Makefile create mode 100644 src/assets/sphinx/template/conf.py create mode 100644 src/assets/sphinx/template/index.rst create mode 100644 src/assets/sphinx/template/make.bat diff --git a/Makefile b/Makefile index ddd594fc..83274d9d 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,7 @@ # # ################################################################################ +SPHINX_DIR = sphinx # List targets in this Makefile and basic descriptions for them. help: @$(PCOMMAND) makefile_target_list Makefile @@ -183,6 +184,10 @@ docs: docs-pdoc: @$(PCOMMAND) gen_docs_pdoc +docs-sphinx: + $(MAKE) dummymodules + @$(PCOMMAND) gen_docs_sphinx + pcommandbatch_speed_test: prereqs @$(PCOMMAND) pcommandbatch_speed_test $(PCOMMANDBATCH) diff --git a/src/assets/sphinx/template/Makefile b/src/assets/sphinx/template/Makefile new file mode 100644 index 00000000..d4bb2cbb --- /dev/null +++ b/src/assets/sphinx/template/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/src/assets/sphinx/template/conf.py b/src/assets/sphinx/template/conf.py new file mode 100644 index 00000000..98324e13 --- /dev/null +++ b/src/assets/sphinx/template/conf.py @@ -0,0 +1,61 @@ +# Configuration file for the Sphinx documentation builder. +# +# This file only contains a selection of the most common options. For a full +# list see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +import os +import sys +sys.path.insert(0, os.path.abspath(os.getenv('BALLISTICA_ROOT')+'/src/assets/ba_data/python/')) +sys.path.insert(0, os.path.abspath(os.getenv('BALLISTICA_ROOT')+'/tools/efro/')) + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'sphinx_rtd_theme' #'python_docs_theme' #"groundwork" + + +# -- Project information ----------------------------------------------------- + +project = 'ballistica-bombsquad' + +copyright = '2024, Efroemling' +author = 'Efroemling' + +# The full version, including alpha/beta/rc tags +# TODO: make this update from some variable +release = '1.7.33' + + +# -- General configuration --------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +autosummary_generate = True +extensions = ["sphinx.ext.napoleon", # https://stackoverflow.com/questions/45880348/how-to-remove-the-cause-of-an-unexpected-indentation-warning-when-generating-cod + "sphinx.ext.autodoc", +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + + + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] diff --git a/src/assets/sphinx/template/index.rst b/src/assets/sphinx/template/index.rst new file mode 100644 index 00000000..c23321c8 --- /dev/null +++ b/src/assets/sphinx/template/index.rst @@ -0,0 +1,20 @@ +.. Bombsquad-docs documentation master file, created by + sphinx-quickstart on Sat Mar 2 18:31:19 2024. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to Bombsquad-docs's documentation! +========================================== + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + modules + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/src/assets/sphinx/template/make.bat b/src/assets/sphinx/template/make.bat new file mode 100644 index 00000000..32bb2452 --- /dev/null +++ b/src/assets/sphinx/template/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.https://www.sphinx-doc.org/ + exit /b 1 +) + +if "%1" == "" goto help + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd From 2e65fc17709d8da9956e3c6221470415c55f151e Mon Sep 17 00:00:00 2001 From: Loup-Garou911XD Date: Wed, 6 Mar 2024 01:04:53 +0530 Subject: [PATCH 02/24] modified: .gitignore modified: tools/batools/docs.py modified: tools/batools/pcommands.py modified: tools/pcommand --- .gitignore | 1 + tools/batools/docs.py | 44 ++++++++++++++++++++++++++++++++++++++ tools/batools/pcommands.py | 11 ++++++---- tools/pcommand | 1 + 4 files changed, 53 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 273c7b58..b0069d19 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,7 @@ local.properties PUBSYNC_IN_PROGRESS _fulltest_buildfile_* ballistica_files/ +src/assets/sphinx/apidoc **/.#* # Environment files diff --git a/tools/batools/docs.py b/tools/batools/docs.py index 0c9c05e1..4f89dccd 100755 --- a/tools/batools/docs.py +++ b/tools/batools/docs.py @@ -212,3 +212,47 @@ def _run_pdoc() -> None: duration = time.monotonic() - starttime print(f'{Clr.GRN}Generated pdoc documentation in {duration:.1f}s.{Clr.RST}') + +def generate_sphinxdoc(): + _run_sphinx() + +def _run_sphinx() -> None: + """Do the actual docs generation with sphinx.""" + import time + import shutil + + from batools.version import get_current_version + version, buildnum = get_current_version() + + sphinx_src = 'src/assets/sphinx/' + build_dir = 'build/docs_sphinx_html' + sphinx_apidoc_out = sphinx_src + 'apidoc/' + template_dir = Path(sphinx_src+'template/') + assets_dir = 'src/assets/ba_data/python/' + dummy_modules_dir = 'build/dummymodules/' + os.makedirs(build_dir, exist_ok=True) + os.makedirs(sphinx_apidoc_out, exist_ok=True) + assert template_dir.is_dir() + + shutil.copytree(template_dir, sphinx_apidoc_out, dirs_exist_ok= True) + + os.environ['BALLISTICA_ROOT'] = os.getcwd() + + starttime = time.monotonic() + + subprocess.run(['sphinx-apidoc', + '-f', # Force overwriting of any existing generated files. + '-H', 'Bombsquad', # project + '-A','Efroemling', # author + '-V', str(version), # version + '-R', str(buildnum), # release + # '--templatedir', template_dir, + '-o', sphinx_apidoc_out, + assets_dir, ], + # dummy_modules_dir], # dummy modules doesn't get included like this + check=True) + + + subprocess.run( ['make', 'html'], check = True, cwd= sphinx_apidoc_out) + duration = time.monotonic() - starttime + print(f'Generated sphinx documentation in {duration:.1f}s.') diff --git a/tools/batools/pcommands.py b/tools/batools/pcommands.py index 8fa3e42e..99fc72f1 100644 --- a/tools/batools/pcommands.py +++ b/tools/batools/pcommands.py @@ -561,6 +561,9 @@ def gen_docs_pdoc() -> None: print(f'{Clr.BLU}Generating documentation...{Clr.RST}') batools.docs.generate_pdoc(projroot=str(pcommand.PROJROOT)) +def gen_docs_sphinx(): + import batools.docs + batools.docs.generate_sphinxdoc() def list_pip_reqs() -> None: """List Python Pip packages needed for this project.""" @@ -581,12 +584,12 @@ def install_pip_reqs() -> None: pcommand.disallow_in_batch() # Make sure pip itself is up to date first. - subprocess.run( - [PYTHON_BIN, '-m', 'pip', 'install', '--upgrade', 'pip'], check=True - ) +# subprocess.run( +# [PYTHON_BIN, '-m', 'pip', 'install', '--upgrade', 'pip'], check=True +# ) subprocess.run( - [PYTHON_BIN, '-m', 'pip', 'install', '--upgrade'] + get_pip_reqs(), + [PYTHON_BIN, '-m', 'pip', 'install', '--upgrade', '--break-system-packages'] + get_pip_reqs(), check=True, ) print(f'{Clr.GRN}All pip requirements installed!{Clr.RST}') diff --git a/tools/pcommand b/tools/pcommand index 5cd05df5..0a6eef2a 100755 --- a/tools/pcommand +++ b/tools/pcommand @@ -99,6 +99,7 @@ from batools.pcommands import ( get_modern_make, warm_start_asset_build, gen_docs_pdoc, + gen_docs_sphinx, list_pip_reqs, install_pip_reqs, checkenv, From 6a39f050dc7b8579b30b8e1465150698917575a0 Mon Sep 17 00:00:00 2001 From: Loup-Garou911XD Date: Thu, 7 Mar 2024 11:40:43 +0530 Subject: [PATCH 03/24] modified: .gitignore modified: src/assets/sphinx/template/conf.py modified: tools/batools/docs.py --- .gitignore | 2 +- src/assets/sphinx/template/conf.py | 3 +-- tools/batools/docs.py | 23 +++++++++++++++++------ 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index b0069d19..fdbb6ee1 100644 --- a/.gitignore +++ b/.gitignore @@ -30,7 +30,7 @@ local.properties PUBSYNC_IN_PROGRESS _fulltest_buildfile_* ballistica_files/ -src/assets/sphinx/apidoc +src/assets/sphinx/.modules **/.#* # Environment files diff --git a/src/assets/sphinx/template/conf.py b/src/assets/sphinx/template/conf.py index 98324e13..9599dcf2 100644 --- a/src/assets/sphinx/template/conf.py +++ b/src/assets/sphinx/template/conf.py @@ -12,8 +12,7 @@ # import os import sys -sys.path.insert(0, os.path.abspath(os.getenv('BALLISTICA_ROOT')+'/src/assets/ba_data/python/')) -sys.path.insert(0, os.path.abspath(os.getenv('BALLISTICA_ROOT')+'/tools/efro/')) +sys.path.insert(0, os.path.abspath(os.getenv('BALLISTICA_ROOT')+'/src/assets/sphinx/.modules/')) # -- Options for HTML output ------------------------------------------------- diff --git a/tools/batools/docs.py b/tools/batools/docs.py index 4f89dccd..287645ff 100755 --- a/tools/batools/docs.py +++ b/tools/batools/docs.py @@ -224,15 +224,25 @@ def _run_sphinx() -> None: from batools.version import get_current_version version, buildnum = get_current_version() + assets_dirs : dict = {'ba_data':'src/assets/ba_data/python/', + 'dummy_modules':'build/dummymodules/', + 'efro_package':'tools/efro/', + 'bacommon_package':'tools/bacommon/'} + sphinx_src = 'src/assets/sphinx/' build_dir = 'build/docs_sphinx_html' - sphinx_apidoc_out = sphinx_src + 'apidoc/' - template_dir = Path(sphinx_src+'template/') - assets_dir = 'src/assets/ba_data/python/' - dummy_modules_dir = 'build/dummymodules/' os.makedirs(build_dir, exist_ok=True) + template_dir = Path(sphinx_src+'template/') + temp_modules_dir = sphinx_src + '.modules/' + sphinx_apidoc_out = temp_modules_dir + 'apidoc/' os.makedirs(sphinx_apidoc_out, exist_ok=True) + assert template_dir.is_dir() + os.makedirs(temp_modules_dir, exist_ok=True) + shutil.copytree(assets_dirs['ba_data'], temp_modules_dir, dirs_exist_ok=True) + shutil.copytree(assets_dirs['dummy_modules'], temp_modules_dir, dirs_exist_ok=True) + shutil.copytree(assets_dirs['efro_package'], temp_modules_dir + 'efro/', dirs_exist_ok=True) + shutil.copytree(assets_dirs['bacommon_package'], temp_modules_dir + 'bacommon/', dirs_exist_ok=True) shutil.copytree(template_dir, sphinx_apidoc_out, dirs_exist_ok= True) @@ -248,11 +258,12 @@ def _run_sphinx() -> None: '-R', str(buildnum), # release # '--templatedir', template_dir, '-o', sphinx_apidoc_out, - assets_dir, ], - # dummy_modules_dir], # dummy modules doesn't get included like this + temp_modules_dir, ], check=True) subprocess.run( ['make', 'html'], check = True, cwd= sphinx_apidoc_out) + shutil.copytree(sphinx_apidoc_out + '_build/html/', build_dir, dirs_exist_ok=True) + shutil.rmtree(temp_modules_dir) duration = time.monotonic() - starttime print(f'Generated sphinx documentation in {duration:.1f}s.') From 77e3c21d77f8a9bb87bcd557a218cba2a51b6128 Mon Sep 17 00:00:00 2001 From: Loup-Garou911XD Date: Thu, 7 Mar 2024 12:37:41 +0530 Subject: [PATCH 04/24] modified: Makefile modified: src/assets/sphinx/template/conf.py modified: tools/batools/docs.py --- Makefile | 2 +- src/assets/sphinx/template/conf.py | 3 ++- tools/batools/docs.py | 8 +++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 83274d9d..8c7f6ea0 100644 --- a/Makefile +++ b/Makefile @@ -185,7 +185,7 @@ docs-pdoc: @$(PCOMMAND) gen_docs_pdoc docs-sphinx: - $(MAKE) dummymodules +# $(MAKE) dummymodules @$(PCOMMAND) gen_docs_sphinx pcommandbatch_speed_test: prereqs diff --git a/src/assets/sphinx/template/conf.py b/src/assets/sphinx/template/conf.py index 9599dcf2..6b947ba2 100644 --- a/src/assets/sphinx/template/conf.py +++ b/src/assets/sphinx/template/conf.py @@ -12,7 +12,8 @@ # import os import sys -sys.path.insert(0, os.path.abspath(os.getenv('BALLISTICA_ROOT')+'/src/assets/sphinx/.modules/')) + +sys.path.insert(0, os.path.abspath('..')) # -- Options for HTML output ------------------------------------------------- diff --git a/tools/batools/docs.py b/tools/batools/docs.py index 287645ff..b2062425 100755 --- a/tools/batools/docs.py +++ b/tools/batools/docs.py @@ -213,7 +213,7 @@ def _run_pdoc() -> None: duration = time.monotonic() - starttime print(f'{Clr.GRN}Generated pdoc documentation in {duration:.1f}s.{Clr.RST}') -def generate_sphinxdoc(): +def generate_sphinxdoc() -> None: _run_sphinx() def _run_sphinx() -> None: @@ -245,9 +245,7 @@ def _run_sphinx() -> None: shutil.copytree(assets_dirs['bacommon_package'], temp_modules_dir + 'bacommon/', dirs_exist_ok=True) shutil.copytree(template_dir, sphinx_apidoc_out, dirs_exist_ok= True) - - os.environ['BALLISTICA_ROOT'] = os.getcwd() - + starttime = time.monotonic() subprocess.run(['sphinx-apidoc', @@ -264,6 +262,6 @@ def _run_sphinx() -> None: subprocess.run( ['make', 'html'], check = True, cwd= sphinx_apidoc_out) shutil.copytree(sphinx_apidoc_out + '_build/html/', build_dir, dirs_exist_ok=True) - shutil.rmtree(temp_modules_dir) + # shutil.rmtree(temp_modules_dir) duration = time.monotonic() - starttime print(f'Generated sphinx documentation in {duration:.1f}s.') From f36d157d9e5d6003b3ab6fb58c2f5125897797ce Mon Sep 17 00:00:00 2001 From: Loup-Garou911XD Date: Thu, 7 Mar 2024 12:53:13 +0530 Subject: [PATCH 05/24] modified: .github/workflows/cd.yml --- .github/workflows/cd.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index f88e4998..9387c482 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -4,6 +4,7 @@ on: # Run on pushes and pull-requests push: pull_request: + jobs: make_linux_x86_64_gui_debug_build: @@ -206,3 +207,25 @@ jobs: with: name: windows_x86_server_(debug) path: build/prefab/full/windows_x86_server + make_sphinx_docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + # Remove this once we upgrade to 3.12. + - name: Install typing_extensions (temp) + run: python3.11 -m pip install typing_extensions + - name: Install sphinx + run: python3.11 -m pip install sphinx sphinx-rtd-theme + - name: Install pip requirements + run: tools/pcommand install_pip_reqs + - name: Make the build + run: make docs-sphinx + - name: Upload the build + uses: actions/upload-artifact@v3 + with: + name: sphinx_html_docs + path: build/docs_sphinx_html \ No newline at end of file From e24f1747b697d86fc00f1b32bfe11b266832a9a1 Mon Sep 17 00:00:00 2001 From: Loup-Garou911XD Date: Thu, 7 Mar 2024 12:55:22 +0530 Subject: [PATCH 06/24] modified: Makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8c7f6ea0..83274d9d 100644 --- a/Makefile +++ b/Makefile @@ -185,7 +185,7 @@ docs-pdoc: @$(PCOMMAND) gen_docs_pdoc docs-sphinx: -# $(MAKE) dummymodules + $(MAKE) dummymodules @$(PCOMMAND) gen_docs_sphinx pcommandbatch_speed_test: prereqs From 24676733341c3c3cf60593dd68582a937259f7c1 Mon Sep 17 00:00:00 2001 From: Loup-Garou911XD Date: Thu, 7 Mar 2024 15:22:25 +0530 Subject: [PATCH 07/24] modified: src/assets/sphinx/template/conf.py modified: tools/batools/docs.py --- src/assets/sphinx/template/conf.py | 10 +++++++++- tools/batools/docs.py | 26 +++++++++++--------------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/assets/sphinx/template/conf.py b/src/assets/sphinx/template/conf.py index 6b947ba2..6650066a 100644 --- a/src/assets/sphinx/template/conf.py +++ b/src/assets/sphinx/template/conf.py @@ -13,7 +13,15 @@ import os import sys -sys.path.insert(0, os.path.abspath('..')) +ba_root = os.getenv('BALLISTICA_ROOT') + '/' +assets_dirs : dict = {'ba_data':'src/assets/ba_data/python/', + 'dummy_modules':'build/dummymodules/', + 'efro_tools':'tools/', # for efro and bacommon package + } + +sys.path.append(os.path.abspath(ba_root+assets_dirs['ba_data'])) +sys.path.append(os.path.abspath(ba_root+assets_dirs['dummy_modules'])) +sys.path.append(os.path.abspath(ba_root+assets_dirs['efro_tools'])) # -- Options for HTML output ------------------------------------------------- diff --git a/tools/batools/docs.py b/tools/batools/docs.py index b2062425..ff900fc4 100755 --- a/tools/batools/docs.py +++ b/tools/batools/docs.py @@ -226,24 +226,20 @@ def _run_sphinx() -> None: assets_dirs : dict = {'ba_data':'src/assets/ba_data/python/', 'dummy_modules':'build/dummymodules/', - 'efro_package':'tools/efro/', - 'bacommon_package':'tools/bacommon/'} + 'efro_tools':'tools/', # for efro and bacommon package + } sphinx_src = 'src/assets/sphinx/' - build_dir = 'build/docs_sphinx_html' - os.makedirs(build_dir, exist_ok=True) template_dir = Path(sphinx_src+'template/') - temp_modules_dir = sphinx_src + '.modules/' - sphinx_apidoc_out = temp_modules_dir + 'apidoc/' + assert template_dir.is_dir() + build_dir = 'build/sphinx/' + os.makedirs(build_dir, exist_ok=True) + sphinx_apidoc_out = build_dir + 'apidoc/' os.makedirs(sphinx_apidoc_out, exist_ok=True) - assert template_dir.is_dir() - os.makedirs(temp_modules_dir, exist_ok=True) - shutil.copytree(assets_dirs['ba_data'], temp_modules_dir, dirs_exist_ok=True) - shutil.copytree(assets_dirs['dummy_modules'], temp_modules_dir, dirs_exist_ok=True) - shutil.copytree(assets_dirs['efro_package'], temp_modules_dir + 'efro/', dirs_exist_ok=True) - shutil.copytree(assets_dirs['bacommon_package'], temp_modules_dir + 'bacommon/', dirs_exist_ok=True) - + + os.environ['BALLISTICA_ROOT'] = os.getcwd() + shutil.copytree(template_dir, sphinx_apidoc_out, dirs_exist_ok= True) starttime = time.monotonic() @@ -256,12 +252,12 @@ def _run_sphinx() -> None: '-R', str(buildnum), # release # '--templatedir', template_dir, '-o', sphinx_apidoc_out, - temp_modules_dir, ], + assets_dirs['ba_data'], ], check=True) subprocess.run( ['make', 'html'], check = True, cwd= sphinx_apidoc_out) - shutil.copytree(sphinx_apidoc_out + '_build/html/', build_dir, dirs_exist_ok=True) + shutil.copytree(sphinx_apidoc_out + '_build/html/', build_dir+'html/', dirs_exist_ok=True) # shutil.rmtree(temp_modules_dir) duration = time.monotonic() - starttime print(f'Generated sphinx documentation in {duration:.1f}s.') From 3527214713e9a916ffa3b8406a9636dd0d0640b6 Mon Sep 17 00:00:00 2001 From: Loup-Garou911XD Date: Thu, 7 Mar 2024 16:31:05 +0530 Subject: [PATCH 08/24] modified: Makefile modified: tools/batools/docs.py --- Makefile | 3 +++ tools/batools/docs.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 83274d9d..403ebc07 100644 --- a/Makefile +++ b/Makefile @@ -188,6 +188,9 @@ docs-sphinx: $(MAKE) dummymodules @$(PCOMMAND) gen_docs_sphinx +docs-sphinx-clean: + rm -rf .cache/sphinx + pcommandbatch_speed_test: prereqs @$(PCOMMAND) pcommandbatch_speed_test $(PCOMMANDBATCH) diff --git a/tools/batools/docs.py b/tools/batools/docs.py index ff900fc4..4f02a6f4 100755 --- a/tools/batools/docs.py +++ b/tools/batools/docs.py @@ -234,7 +234,7 @@ def _run_sphinx() -> None: assert template_dir.is_dir() build_dir = 'build/sphinx/' os.makedirs(build_dir, exist_ok=True) - sphinx_apidoc_out = build_dir + 'apidoc/' + sphinx_apidoc_out = '.cache/sphinx/' # might want to use .cache dir os.makedirs(sphinx_apidoc_out, exist_ok=True) @@ -257,7 +257,7 @@ def _run_sphinx() -> None: subprocess.run( ['make', 'html'], check = True, cwd= sphinx_apidoc_out) - shutil.copytree(sphinx_apidoc_out + '_build/html/', build_dir+'html/', dirs_exist_ok=True) + shutil.copytree(sphinx_apidoc_out + '_build/html/', build_dir, dirs_exist_ok=True) # shutil.rmtree(temp_modules_dir) duration = time.monotonic() - starttime print(f'Generated sphinx documentation in {duration:.1f}s.') From 400b950a5178ea2c33c39cde7b2d1ce4c5969102 Mon Sep 17 00:00:00 2001 From: Loup-Garou911XD Date: Thu, 7 Mar 2024 16:31:56 +0530 Subject: [PATCH 09/24] modified: .gitignore --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index fdbb6ee1..273c7b58 100644 --- a/.gitignore +++ b/.gitignore @@ -30,7 +30,6 @@ local.properties PUBSYNC_IN_PROGRESS _fulltest_buildfile_* ballistica_files/ -src/assets/sphinx/.modules **/.#* # Environment files From 30621d58ea74af544ed120d56c72f2b15d6ddcb8 Mon Sep 17 00:00:00 2001 From: Loup-Garou911XD Date: Thu, 7 Mar 2024 16:37:44 +0530 Subject: [PATCH 10/24] modified: .github/workflows/cd.yml --- .github/workflows/cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 9387c482..6d3eec7d 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -228,4 +228,4 @@ jobs: uses: actions/upload-artifact@v3 with: name: sphinx_html_docs - path: build/docs_sphinx_html \ No newline at end of file + path: build/sphinx \ No newline at end of file From c0a49d53047e7d6cb83065cdec3168224ecfd961 Mon Sep 17 00:00:00 2001 From: Loup-Garou911XD Date: Thu, 7 Mar 2024 17:23:53 +0530 Subject: [PATCH 11/24] modified: Makefile modified: src/assets/sphinx/template/conf.py modified: src/assets/sphinx/template/index.rst --- Makefile | 1 + src/assets/sphinx/template/conf.py | 4 +++- src/assets/sphinx/template/index.rst | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 403ebc07..1f31ab07 100644 --- a/Makefile +++ b/Makefile @@ -190,6 +190,7 @@ docs-sphinx: docs-sphinx-clean: rm -rf .cache/sphinx + rm -rf build/sphinx pcommandbatch_speed_test: prereqs @$(PCOMMAND) pcommandbatch_speed_test $(PCOMMANDBATCH) diff --git a/src/assets/sphinx/template/conf.py b/src/assets/sphinx/template/conf.py index 6650066a..aa69f44a 100644 --- a/src/assets/sphinx/template/conf.py +++ b/src/assets/sphinx/template/conf.py @@ -33,6 +33,7 @@ html_theme = 'sphinx_rtd_theme' #'python_docs_theme' #"groundwork" # -- Project information ----------------------------------------------------- +keep_warnings = True # Supressing warnings project = 'ballistica-bombsquad' copyright = '2024, Efroemling' @@ -40,7 +41,8 @@ author = 'Efroemling' # The full version, including alpha/beta/rc tags # TODO: make this update from some variable -release = '1.7.33' +version = '1.7.33' +release = '43241' # -- General configuration --------------------------------------------------- diff --git a/src/assets/sphinx/template/index.rst b/src/assets/sphinx/template/index.rst index c23321c8..0b21db62 100644 --- a/src/assets/sphinx/template/index.rst +++ b/src/assets/sphinx/template/index.rst @@ -9,7 +9,8 @@ Welcome to Bombsquad-docs's documentation! .. toctree:: :maxdepth: 2 :caption: Contents: - modules + + modules Indices and tables From 640565cdf801edf68d4e3e68accb50d17aa5ad9b Mon Sep 17 00:00:00 2001 From: Loup-Garou911XD Date: Thu, 7 Mar 2024 17:59:37 +0530 Subject: [PATCH 12/24] Changed theme --- .github/workflows/cd.yml | 2 +- src/assets/sphinx/template/conf.py | 20 ++++++-------------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 6d3eec7d..80a84b71 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -219,7 +219,7 @@ jobs: - name: Install typing_extensions (temp) run: python3.11 -m pip install typing_extensions - name: Install sphinx - run: python3.11 -m pip install sphinx sphinx-rtd-theme + run: python3.11 -m pip install sphinx furo - name: Install pip requirements run: tools/pcommand install_pip_reqs - name: Make the build diff --git a/src/assets/sphinx/template/conf.py b/src/assets/sphinx/template/conf.py index aa69f44a..5ea51981 100644 --- a/src/assets/sphinx/template/conf.py +++ b/src/assets/sphinx/template/conf.py @@ -5,30 +5,23 @@ # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -# import os import sys -ba_root = os.getenv('BALLISTICA_ROOT') + '/' +ballistica_root = os.getenv('BALLISTICA_ROOT') + '/' assets_dirs : dict = {'ba_data':'src/assets/ba_data/python/', 'dummy_modules':'build/dummymodules/', 'efro_tools':'tools/', # for efro and bacommon package } -sys.path.append(os.path.abspath(ba_root+assets_dirs['ba_data'])) -sys.path.append(os.path.abspath(ba_root+assets_dirs['dummy_modules'])) -sys.path.append(os.path.abspath(ba_root+assets_dirs['efro_tools'])) +sys.path.append(os.path.abspath(ballistica_root+assets_dirs['ba_data'])) +sys.path.append(os.path.abspath(ballistica_root+assets_dirs['dummy_modules'])) +sys.path.append(os.path.abspath(ballistica_root+assets_dirs['efro_tools'])) # -- Options for HTML output ------------------------------------------------- -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -# -html_theme = 'sphinx_rtd_theme' #'python_docs_theme' #"groundwork" +html_theme = 'furo' # python_docs_theme, groundwork, furo +# html_logo = ballistica_root + 'build/assets/ba_data/textures/logo_preview.png' # need a smaller img # -- Project information ----------------------------------------------------- @@ -44,7 +37,6 @@ author = 'Efroemling' version = '1.7.33' release = '43241' - # -- General configuration --------------------------------------------------- # Add any Sphinx extension module names here, as strings. They can be From 5f689c80161a6ce5df44412f14ba1dcb1dde7bd6 Mon Sep 17 00:00:00 2001 From: Loup-Garou911XD Date: Thu, 7 Mar 2024 19:01:48 +0530 Subject: [PATCH 13/24] Added dummy modules and modules under tools to generation --- src/assets/sphinx/template/conf.py | 3 ++- tools/batools/docs.py | 13 +++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/assets/sphinx/template/conf.py b/src/assets/sphinx/template/conf.py index 5ea51981..dcc99cdf 100644 --- a/src/assets/sphinx/template/conf.py +++ b/src/assets/sphinx/template/conf.py @@ -20,7 +20,8 @@ sys.path.append(os.path.abspath(ballistica_root+assets_dirs['efro_tools'])) # -- Options for HTML output ------------------------------------------------- -html_theme = 'furo' # python_docs_theme, groundwork, furo +# for more themes visit https://sphinx-themes.org/ +html_theme = 'furo' # python_docs_theme, groundwork, furo # html_logo = ballistica_root + 'build/assets/ba_data/textures/logo_preview.png' # need a smaller img diff --git a/tools/batools/docs.py b/tools/batools/docs.py index 4f02a6f4..7f214383 100755 --- a/tools/batools/docs.py +++ b/tools/batools/docs.py @@ -243,18 +243,19 @@ def _run_sphinx() -> None: shutil.copytree(template_dir, sphinx_apidoc_out, dirs_exist_ok= True) starttime = time.monotonic() - - subprocess.run(['sphinx-apidoc', + + apidoc_cmd = ['sphinx-apidoc', '-f', # Force overwriting of any existing generated files. '-H', 'Bombsquad', # project '-A','Efroemling', # author '-V', str(version), # version '-R', str(buildnum), # release # '--templatedir', template_dir, - '-o', sphinx_apidoc_out, - assets_dirs['ba_data'], ], - check=True) - + '-o', sphinx_apidoc_out, + ] + subprocess.run(apidoc_cmd + [assets_dirs['ba_data']] , check=True) + subprocess.run(apidoc_cmd + [assets_dirs['dummy_modules']], check=True) + subprocess.run(apidoc_cmd + [assets_dirs['efro_tools']], check=True) subprocess.run( ['make', 'html'], check = True, cwd= sphinx_apidoc_out) shutil.copytree(sphinx_apidoc_out + '_build/html/', build_dir, dirs_exist_ok=True) From c199b64a95e5ec28fb339149494f8efd58cbd20f Mon Sep 17 00:00:00 2001 From: Roman Trapeznikov Date: Fri, 8 Mar 2024 14:50:49 +0300 Subject: [PATCH 14/24] test --- tools/batools/docs.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/tools/batools/docs.py b/tools/batools/docs.py index 7f214383..34f2398a 100755 --- a/tools/batools/docs.py +++ b/tools/batools/docs.py @@ -213,7 +213,7 @@ def _run_pdoc() -> None: duration = time.monotonic() - starttime print(f'{Clr.GRN}Generated pdoc documentation in {duration:.1f}s.{Clr.RST}') -def generate_sphinxdoc() -> None: +def generate_sphinxdoc() -> None: _run_sphinx() def _run_sphinx() -> None: @@ -224,11 +224,11 @@ def _run_sphinx() -> None: from batools.version import get_current_version version, buildnum = get_current_version() - assets_dirs : dict = {'ba_data':'src/assets/ba_data/python/', - 'dummy_modules':'build/dummymodules/', + assets_dirs : dict = {'ba_data':'src/assets/ba_data/python/', + 'dummy_modules':'build/dummymodules/', 'efro_tools':'tools/', # for efro and bacommon package } - + sphinx_src = 'src/assets/sphinx/' template_dir = Path(sphinx_src+'template/') assert template_dir.is_dir() @@ -237,26 +237,26 @@ def _run_sphinx() -> None: sphinx_apidoc_out = '.cache/sphinx/' # might want to use .cache dir os.makedirs(sphinx_apidoc_out, exist_ok=True) - + os.environ['BALLISTICA_ROOT'] = os.getcwd() - + shutil.copytree(template_dir, sphinx_apidoc_out, dirs_exist_ok= True) - + starttime = time.monotonic() - - apidoc_cmd = ['sphinx-apidoc', + + apidoc_cmd = ['sphinx-apidoc', '-f', # Force overwriting of any existing generated files. '-H', 'Bombsquad', # project '-A','Efroemling', # author '-V', str(version), # version '-R', str(buildnum), # release - # '--templatedir', template_dir, + # '--templatedir', template_dir, '-o', sphinx_apidoc_out, ] - subprocess.run(apidoc_cmd + [assets_dirs['ba_data']] , check=True) - subprocess.run(apidoc_cmd + [assets_dirs['dummy_modules']], check=True) + subprocess.run(apidoc_cmd + [assets_dirs['ba_data']] , check=True) + subprocess.run(apidoc_cmd + [assets_dirs['dummy_modules']], check=True) subprocess.run(apidoc_cmd + [assets_dirs['efro_tools']], check=True) - + subprocess.run( ['make', 'html'], check = True, cwd= sphinx_apidoc_out) shutil.copytree(sphinx_apidoc_out + '_build/html/', build_dir, dirs_exist_ok=True) # shutil.rmtree(temp_modules_dir) From ff81dac3d3010cf49db52bcb6d968a91ff52d336 Mon Sep 17 00:00:00 2001 From: Loup-Garou911XD Date: Wed, 13 Mar 2024 01:21:00 +0530 Subject: [PATCH 15/24] Fix for the dict error in _babase --- tools/batools/docs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/batools/docs.py b/tools/batools/docs.py index 7f214383..7f3b6d4d 100755 --- a/tools/batools/docs.py +++ b/tools/batools/docs.py @@ -243,7 +243,7 @@ def _run_sphinx() -> None: shutil.copytree(template_dir, sphinx_apidoc_out, dirs_exist_ok= True) starttime = time.monotonic() - + os.environ['BA_RUNNING_WITH_DUMMY_MODULES'] = '1' apidoc_cmd = ['sphinx-apidoc', '-f', # Force overwriting of any existing generated files. '-H', 'Bombsquad', # project From 461a4c016ad6cc5fdb69de48a1be59cfee22d819 Mon Sep 17 00:00:00 2001 From: Loup-Garou911XD Date: Wed, 13 Mar 2024 01:27:44 +0530 Subject: [PATCH 16/24] fixed dict key error in _babase --- tools/batools/docs.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/batools/docs.py b/tools/batools/docs.py index efc1686a..1cabda25 100755 --- a/tools/batools/docs.py +++ b/tools/batools/docs.py @@ -238,7 +238,8 @@ def _run_sphinx() -> None: os.makedirs(sphinx_apidoc_out, exist_ok=True) - os.environ['BALLISTICA_ROOT'] = os.getcwd() + os.environ['BALLISTICA_ROOT'] = os.getcwd() # used in sphinx conf.py + os.environ['BA_RUNNING_WITH_DUMMY_MODULES'] = '1' shutil.copytree(template_dir, sphinx_apidoc_out, dirs_exist_ok= True) From 823739b5080b716e948cc4b35d46d571396e5a1b Mon Sep 17 00:00:00 2001 From: Loup-Garou911XD Date: Wed, 13 Mar 2024 01:47:17 +0530 Subject: [PATCH 17/24] Formatting --- src/assets/sphinx/template/conf.py | 27 +++++++------- tools/batools/docs.py | 57 ++++++++++++++++-------------- 2 files changed, 45 insertions(+), 39 deletions(-) diff --git a/src/assets/sphinx/template/conf.py b/src/assets/sphinx/template/conf.py index dcc99cdf..9d407c28 100644 --- a/src/assets/sphinx/template/conf.py +++ b/src/assets/sphinx/template/conf.py @@ -9,25 +9,26 @@ import os import sys ballistica_root = os.getenv('BALLISTICA_ROOT') + '/' -assets_dirs : dict = {'ba_data':'src/assets/ba_data/python/', - 'dummy_modules':'build/dummymodules/', - 'efro_tools':'tools/', # for efro and bacommon package - } - -sys.path.append(os.path.abspath(ballistica_root+assets_dirs['ba_data'])) -sys.path.append(os.path.abspath(ballistica_root+assets_dirs['dummy_modules'])) -sys.path.append(os.path.abspath(ballistica_root+assets_dirs['efro_tools'])) +assets_dirs: dict = { + 'ba_data': 'src/assets/ba_data/python/', + 'dummy_modules': 'build/dummymodules/', + 'efro_tools': 'tools/', # for efro and bacommon package +} + +sys.path.append(os.path.abspath(ballistica_root + assets_dirs['ba_data'])) +sys.path.append(os.path.abspath(ballistica_root + assets_dirs['dummy_modules'])) +sys.path.append(os.path.abspath(ballistica_root + assets_dirs['efro_tools'])) # -- Options for HTML output ------------------------------------------------- # for more themes visit https://sphinx-themes.org/ -html_theme = 'furo' # python_docs_theme, groundwork, furo +html_theme = 'furo' # python_docs_theme, groundwork, furo # html_logo = ballistica_root + 'build/assets/ba_data/textures/logo_preview.png' # need a smaller img # -- Project information ----------------------------------------------------- -keep_warnings = True # Supressing warnings +keep_warnings = True # Supressing warnings project = 'ballistica-bombsquad' copyright = '2024, Efroemling' @@ -44,8 +45,9 @@ release = '43241' # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. autosummary_generate = True -extensions = ["sphinx.ext.napoleon", # https://stackoverflow.com/questions/45880348/how-to-remove-the-cause-of-an-unexpected-indentation-warning-when-generating-cod - "sphinx.ext.autodoc", +extensions = [ + 'sphinx.ext.napoleon', # https://stackoverflow.com/questions/45880348/how-to-remove-the-cause-of-an-unexpected-indentation-warning-when-generating-cod + 'sphinx.ext.autodoc', ] # Add any paths that contain templates here, relative to this directory. @@ -57,7 +59,6 @@ templates_path = ['_templates'] exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] - # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". diff --git a/tools/batools/docs.py b/tools/batools/docs.py index 1cabda25..9b473781 100755 --- a/tools/batools/docs.py +++ b/tools/batools/docs.py @@ -52,9 +52,7 @@ def parse_docs_attrs(attrs: list[AttributeInfo], docs: str) -> str: # A line with a single alphanumeric word preceding a colon # is a new attr. splits = line.split(' ', maxsplit=1) - if splits[0].replace('_', '').isalnum() and splits[-1].endswith( - ':' - ): + if splits[0].replace('_', '').isalnum() and splits[-1].endswith(':'): if cur_attr is not None: attrs.append(cur_attr) cur_attr = AttributeInfo(name=splits[0]) @@ -144,9 +142,7 @@ def _run_pdoc_with_dummy_modules() -> None: # whatnot here so let's make sure we only do this once. global _g_genned_pdoc_with_dummy_modules # pylint: disable=global-statement if _g_genned_pdoc_with_dummy_modules: - raise RuntimeError( - 'Can only run this once; it mucks with the environment.' - ) + raise RuntimeError('Can only run this once; it mucks with the environment.') _g_genned_pdoc_with_dummy_modules = True # Make sure dummy-modules are up to date and make them discoverable @@ -213,51 +209,60 @@ def _run_pdoc() -> None: duration = time.monotonic() - starttime print(f'{Clr.GRN}Generated pdoc documentation in {duration:.1f}s.{Clr.RST}') + def generate_sphinxdoc() -> None: _run_sphinx() + def _run_sphinx() -> None: """Do the actual docs generation with sphinx.""" import time import shutil from batools.version import get_current_version + version, buildnum = get_current_version() - assets_dirs : dict = {'ba_data':'src/assets/ba_data/python/', - 'dummy_modules':'build/dummymodules/', - 'efro_tools':'tools/', # for efro and bacommon package - } + assets_dirs: dict = { + 'ba_data': 'src/assets/ba_data/python/', + 'dummy_modules': 'build/dummymodules/', + 'efro_tools': 'tools/', # for efro and bacommon package + } sphinx_src = 'src/assets/sphinx/' - template_dir = Path(sphinx_src+'template/') + template_dir = Path(sphinx_src + 'template/') assert template_dir.is_dir() build_dir = 'build/sphinx/' os.makedirs(build_dir, exist_ok=True) - sphinx_apidoc_out = '.cache/sphinx/' # might want to use .cache dir + sphinx_apidoc_out = '.cache/sphinx/' # might want to use .cache dir os.makedirs(sphinx_apidoc_out, exist_ok=True) - - os.environ['BALLISTICA_ROOT'] = os.getcwd() # used in sphinx conf.py + os.environ['BALLISTICA_ROOT'] = os.getcwd() # used in sphinx conf.py os.environ['BA_RUNNING_WITH_DUMMY_MODULES'] = '1' - shutil.copytree(template_dir, sphinx_apidoc_out, dirs_exist_ok= True) + shutil.copytree(template_dir, sphinx_apidoc_out, dirs_exist_ok=True) starttime = time.monotonic() - apidoc_cmd = ['sphinx-apidoc', - '-f', # Force overwriting of any existing generated files. - '-H', 'Bombsquad', # project - '-A','Efroemling', # author - '-V', str(version), # version - '-R', str(buildnum), # release - # '--templatedir', template_dir, - '-o', sphinx_apidoc_out, - ] - subprocess.run(apidoc_cmd + [assets_dirs['ba_data']] , check=True) + apidoc_cmd = [ + 'sphinx-apidoc', + '-f', # Force overwriting of any existing generated files. + '-H', + 'Bombsquad', # project + '-A', + 'Efroemling', # author + '-V', + str(version), # version + '-R', + str(buildnum), # release + # '--templatedir', template_dir, + '-o', + sphinx_apidoc_out, + ] + subprocess.run(apidoc_cmd + [assets_dirs['ba_data']], check=True) subprocess.run(apidoc_cmd + [assets_dirs['dummy_modules']], check=True) subprocess.run(apidoc_cmd + [assets_dirs['efro_tools']], check=True) - subprocess.run( ['make', 'html'], check = True, cwd= sphinx_apidoc_out) + subprocess.run(['make', 'html'], check=True, cwd=sphinx_apidoc_out) shutil.copytree(sphinx_apidoc_out + '_build/html/', build_dir, dirs_exist_ok=True) # shutil.rmtree(temp_modules_dir) duration = time.monotonic() - starttime From e09acbe2d7be2893dd8fb05f712576dc0e9f8bd0 Mon Sep 17 00:00:00 2001 From: Loup-Garou911XD Date: Wed, 13 Mar 2024 02:00:00 +0530 Subject: [PATCH 18/24] Removed unused stuff --- .github/workflows/cd.yml | 1 - Makefile | 1 - tools/batools/pcommands.py | 8 ++++---- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 80a84b71..9c83bc84 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -4,7 +4,6 @@ on: # Run on pushes and pull-requests push: pull_request: - jobs: make_linux_x86_64_gui_debug_build: diff --git a/Makefile b/Makefile index 1f31ab07..e43ffd49 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,6 @@ # # ################################################################################ -SPHINX_DIR = sphinx # List targets in this Makefile and basic descriptions for them. help: @$(PCOMMAND) makefile_target_list Makefile diff --git a/tools/batools/pcommands.py b/tools/batools/pcommands.py index 99fc72f1..b2bbc806 100644 --- a/tools/batools/pcommands.py +++ b/tools/batools/pcommands.py @@ -584,12 +584,12 @@ def install_pip_reqs() -> None: pcommand.disallow_in_batch() # Make sure pip itself is up to date first. -# subprocess.run( -# [PYTHON_BIN, '-m', 'pip', 'install', '--upgrade', 'pip'], check=True -# ) + subprocess.run( + [PYTHON_BIN, '-m', 'pip', 'install', '--upgrade', 'pip'], check=True + ) subprocess.run( - [PYTHON_BIN, '-m', 'pip', 'install', '--upgrade', '--break-system-packages'] + get_pip_reqs(), + [PYTHON_BIN, '-m', 'pip', 'install', '--upgrade'] + get_pip_reqs(), check=True, ) print(f'{Clr.GRN}All pip requirements installed!{Clr.RST}') From b94a3a13e6931817f69c322ed9cfa8b11ecc3c94 Mon Sep 17 00:00:00 2001 From: Loup-Garou911XD Date: Wed, 13 Mar 2024 03:16:33 +0530 Subject: [PATCH 19/24] ci fix --- config/spinoffconfig.py | 1 + tools/batools/pcommands.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/config/spinoffconfig.py b/config/spinoffconfig.py index 26e97c36..6844d1c5 100644 --- a/config/spinoffconfig.py +++ b/config/spinoffconfig.py @@ -278,6 +278,7 @@ ctx.filter_file_extensions = { '.xcsettings', '.xcstrings', '.filters', + '.rst', } # ELSE files with these extensions will NOT be filtered. diff --git a/tools/batools/pcommands.py b/tools/batools/pcommands.py index b2bbc806..00e849d9 100644 --- a/tools/batools/pcommands.py +++ b/tools/batools/pcommands.py @@ -561,10 +561,13 @@ def gen_docs_pdoc() -> None: print(f'{Clr.BLU}Generating documentation...{Clr.RST}') batools.docs.generate_pdoc(projroot=str(pcommand.PROJROOT)) -def gen_docs_sphinx(): + +def gen_docs_sphinx() -> None: import batools.docs + batools.docs.generate_sphinxdoc() + def list_pip_reqs() -> None: """List Python Pip packages needed for this project.""" from batools.build import get_pip_reqs From d8eb801ae327cb6ec68ec0fa237d73cbb03adbc6 Mon Sep 17 00:00:00 2001 From: Loup-Garou911XD Date: Wed, 13 Mar 2024 03:21:30 +0530 Subject: [PATCH 20/24] Very important commit --- CONTRIBUTORS.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index e6663602..98340116 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -57,3 +57,7 @@ ### brostos - Added support for joining using ipv6 address + +### Loup Garou +- Added sphinx documentation generation + From e7fc66c7386c0e0a0b39063568d4347eb2ea06f0 Mon Sep 17 00:00:00 2001 From: Loup-Garou911XD Date: Wed, 13 Mar 2024 03:31:32 +0530 Subject: [PATCH 21/24] ci fix --- tools/batools/docs.py | 12 +++++++++--- tools/batools/pcommands.py | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/tools/batools/docs.py b/tools/batools/docs.py index 9b473781..6e81f8a7 100755 --- a/tools/batools/docs.py +++ b/tools/batools/docs.py @@ -52,7 +52,9 @@ def parse_docs_attrs(attrs: list[AttributeInfo], docs: str) -> str: # A line with a single alphanumeric word preceding a colon # is a new attr. splits = line.split(' ', maxsplit=1) - if splits[0].replace('_', '').isalnum() and splits[-1].endswith(':'): + if splits[0].replace('_', '').isalnum() and splits[-1].endswith( + ':' + ): if cur_attr is not None: attrs.append(cur_attr) cur_attr = AttributeInfo(name=splits[0]) @@ -142,7 +144,9 @@ def _run_pdoc_with_dummy_modules() -> None: # whatnot here so let's make sure we only do this once. global _g_genned_pdoc_with_dummy_modules # pylint: disable=global-statement if _g_genned_pdoc_with_dummy_modules: - raise RuntimeError('Can only run this once; it mucks with the environment.') + raise RuntimeError( + 'Can only run this once; it mucks with the environment.' + ) _g_genned_pdoc_with_dummy_modules = True # Make sure dummy-modules are up to date and make them discoverable @@ -263,7 +267,9 @@ def _run_sphinx() -> None: subprocess.run(apidoc_cmd + [assets_dirs['efro_tools']], check=True) subprocess.run(['make', 'html'], check=True, cwd=sphinx_apidoc_out) - shutil.copytree(sphinx_apidoc_out + '_build/html/', build_dir, dirs_exist_ok=True) + shutil.copytree( + sphinx_apidoc_out + '_build/html/', build_dir, dirs_exist_ok=True + ) # shutil.rmtree(temp_modules_dir) duration = time.monotonic() - starttime print(f'Generated sphinx documentation in {duration:.1f}s.') diff --git a/tools/batools/pcommands.py b/tools/batools/pcommands.py index 00e849d9..eb2be2cb 100644 --- a/tools/batools/pcommands.py +++ b/tools/batools/pcommands.py @@ -563,6 +563,7 @@ def gen_docs_pdoc() -> None: def gen_docs_sphinx() -> None: + """Generate sphinx documentation.""" import batools.docs batools.docs.generate_sphinxdoc() From 582dda61f84fc5ad379e1e5629b9dc6e8bfb9d9c Mon Sep 17 00:00:00 2001 From: Loup-Garou911XD Date: Wed, 13 Mar 2024 04:09:29 +0530 Subject: [PATCH 22/24] ci fix --- tools/batools/docs.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/batools/docs.py b/tools/batools/docs.py index 6e81f8a7..0b5ee88c 100755 --- a/tools/batools/docs.py +++ b/tools/batools/docs.py @@ -215,6 +215,7 @@ def _run_pdoc() -> None: def generate_sphinxdoc() -> None: + """Generate a set of pdoc documentation.""" _run_sphinx() From 3e05eedb876a51d525de5807617e42a27dc56b0c Mon Sep 17 00:00:00 2001 From: Loup-Garou911XD Date: Wed, 13 Mar 2024 04:09:51 +0530 Subject: [PATCH 23/24] ci fix --- tools/batools/spinoff/_context.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/batools/spinoff/_context.py b/tools/batools/spinoff/_context.py index d61b7486..c516721c 100644 --- a/tools/batools/spinoff/_context.py +++ b/tools/batools/spinoff/_context.py @@ -1563,7 +1563,7 @@ class SpinoffContext: os.remove(delete_file_name) def _is_project_file(self, path: str) -> bool: - if path.startswith('tools/') or path.startswith('src/external'): + if path.startswith('tools/') or path.startswith('src/external') or path.startswith('src/assets/sphinx'): return False bname = os.path.basename(path) return ( From da30d106c43f3be59f5ed6c1c4bbcd7642646813 Mon Sep 17 00:00:00 2001 From: Loup-Garou911XD Date: Wed, 13 Mar 2024 04:10:54 +0530 Subject: [PATCH 24/24] ci fix --- tools/batools/spinoff/_context.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/batools/spinoff/_context.py b/tools/batools/spinoff/_context.py index c516721c..b0870822 100644 --- a/tools/batools/spinoff/_context.py +++ b/tools/batools/spinoff/_context.py @@ -1563,7 +1563,11 @@ class SpinoffContext: os.remove(delete_file_name) def _is_project_file(self, path: str) -> bool: - if path.startswith('tools/') or path.startswith('src/external') or path.startswith('src/assets/sphinx'): + if ( + path.startswith('tools/') + or path.startswith('src/external') + or path.startswith('src/assets/sphinx') + ): return False bname = os.path.basename(path) return (