Skip to content

Commit

Permalink
Handles the case where the documentation should be built from a JSBSi…
Browse files Browse the repository at this point in the history
…m module installed with `pip`.

If `cmake` is called but the module `_jsbsim` is not built, then Sphinx complains because the build directory contains an incomplete `jsbsim` module.

This commit works around that situation by allowing Sphinx to use a version of JSBSim that has been globally installed (with `pip` for instance) rather than the half-baked version that may reside in `build/tests`.

The purpose of this commit is to allow building the Python docs with a JSBSim module that has been installed by `pip`. This saves an additional complete build of the Python module when releasing JSBSim with our CI/CD workflow in GitHub.
  • Loading branch information
bcoconni committed Jan 28, 2023
1 parent 24c3517 commit 98535e8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions doc/python/sphinx/conf.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ import sys

sys.path.insert(0, '${CMAKE_BINARY_DIR}/tests')

try:
import jsbsim._jsbsim
except ModuleNotFoundError:
# If the JSBSim module cannot be loaded from the `tests` folder then
# restore `sys.path` to its inital value and use the globally installed
# JSBSim module, if there is one.
sys.path = sys.path[1:]

# -- Project information -----------------------------------------------------

project = u'JSBSim'
Expand Down

0 comments on commit 98535e8

Please sign in to comment.