mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-02-06 15:47:06 +08:00
modified: .gitignore
modified: tools/batools/docs.py modified: tools/batools/pcommands.py modified: tools/pcommand
This commit is contained in:
parent
1bea10190b
commit
2e65fc1770
1
.gitignore
vendored
1
.gitignore
vendored
@ -30,6 +30,7 @@ local.properties
|
|||||||
PUBSYNC_IN_PROGRESS
|
PUBSYNC_IN_PROGRESS
|
||||||
_fulltest_buildfile_*
|
_fulltest_buildfile_*
|
||||||
ballistica_files/
|
ballistica_files/
|
||||||
|
src/assets/sphinx/apidoc
|
||||||
**/.#*
|
**/.#*
|
||||||
|
|
||||||
# Environment files
|
# Environment files
|
||||||
|
|||||||
@ -212,3 +212,47 @@ def _run_pdoc() -> None:
|
|||||||
|
|
||||||
duration = time.monotonic() - starttime
|
duration = time.monotonic() - starttime
|
||||||
print(f'{Clr.GRN}Generated pdoc documentation in {duration:.1f}s.{Clr.RST}')
|
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.')
|
||||||
|
|||||||
@ -561,6 +561,9 @@ def gen_docs_pdoc() -> None:
|
|||||||
print(f'{Clr.BLU}Generating documentation...{Clr.RST}')
|
print(f'{Clr.BLU}Generating documentation...{Clr.RST}')
|
||||||
batools.docs.generate_pdoc(projroot=str(pcommand.PROJROOT))
|
batools.docs.generate_pdoc(projroot=str(pcommand.PROJROOT))
|
||||||
|
|
||||||
|
def gen_docs_sphinx():
|
||||||
|
import batools.docs
|
||||||
|
batools.docs.generate_sphinxdoc()
|
||||||
|
|
||||||
def list_pip_reqs() -> None:
|
def list_pip_reqs() -> None:
|
||||||
"""List Python Pip packages needed for this project."""
|
"""List Python Pip packages needed for this project."""
|
||||||
@ -581,12 +584,12 @@ def install_pip_reqs() -> None:
|
|||||||
pcommand.disallow_in_batch()
|
pcommand.disallow_in_batch()
|
||||||
|
|
||||||
# Make sure pip itself is up to date first.
|
# Make sure pip itself is up to date first.
|
||||||
subprocess.run(
|
# subprocess.run(
|
||||||
[PYTHON_BIN, '-m', 'pip', 'install', '--upgrade', 'pip'], check=True
|
# [PYTHON_BIN, '-m', 'pip', 'install', '--upgrade', 'pip'], check=True
|
||||||
)
|
# )
|
||||||
|
|
||||||
subprocess.run(
|
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,
|
check=True,
|
||||||
)
|
)
|
||||||
print(f'{Clr.GRN}All pip requirements installed!{Clr.RST}')
|
print(f'{Clr.GRN}All pip requirements installed!{Clr.RST}')
|
||||||
|
|||||||
@ -99,6 +99,7 @@ from batools.pcommands import (
|
|||||||
get_modern_make,
|
get_modern_make,
|
||||||
warm_start_asset_build,
|
warm_start_asset_build,
|
||||||
gen_docs_pdoc,
|
gen_docs_pdoc,
|
||||||
|
gen_docs_sphinx,
|
||||||
list_pip_reqs,
|
list_pip_reqs,
|
||||||
install_pip_reqs,
|
install_pip_reqs,
|
||||||
checkenv,
|
checkenv,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user