|
14 | 14 | # |
15 | 15 | import os |
16 | 16 | import sys |
| 17 | +import subprocess |
17 | 18 |
|
18 | 19 | # Add python modules to be documented |
19 | 20 | python_root = '..' |
20 | 21 | python_modules = ( 'geos-ats', 'geos-geomechanics', 'geos-mesh', 'geos-processing', 'geos-pv', 'geos-timehistory', |
21 | | - 'geos-utils', 'geos-xml-tools', 'geos-xml-viewer', 'hdf5-wrapper', 'pygeos-tools' ) |
| 22 | + 'geos-utils', 'geos-xml-tools', 'geos-xml-viewer', 'hdf5-wrapper', 'mesh-doctor', 'pygeos-tools' ) |
22 | 23 |
|
23 | 24 |
|
24 | 25 | for m in python_modules: |
25 | 26 | sys.path.insert( 0, os.path.abspath( os.path.join( python_root, m, 'src' ) ) ) |
26 | 27 |
|
| 28 | +# Install mesh-doctor in editable mode if not already available |
| 29 | +# This ensures mesh-doctor command is available for sphinxcontrib.programoutput |
| 30 | +try: |
| 31 | + subprocess.run( [ sys.executable, '-m', 'geos.mesh_doctor.cli', '--help' ], |
| 32 | + capture_output=True, check=True, timeout=5 ) |
| 33 | +except ( subprocess.CalledProcessError, subprocess.TimeoutExpired, FileNotFoundError ): |
| 34 | + # mesh-doctor not available, install it and its dependencies in editable mode |
| 35 | + print( "Installing mesh-doctor dependencies for documentation generation..." ) |
| 36 | + packages_to_install = [ 'geos-utils', 'geos-mesh', 'mesh-doctor' ] |
| 37 | + for pkg in packages_to_install: |
| 38 | + pkg_path = os.path.abspath( os.path.join( python_root, pkg ) ) |
| 39 | + try: |
| 40 | + print( f" Installing {pkg}..." ) |
| 41 | + subprocess.run( [ sys.executable, '-m', 'pip', 'install', '-e', pkg_path ], |
| 42 | + check=True, capture_output=True ) |
| 43 | + except subprocess.CalledProcessError as e: |
| 44 | + print( f"Warning: Could not install {pkg}: {e}" ) |
| 45 | + print( "Documentation may be incomplete." ) |
| 46 | + break |
| 47 | + else: |
| 48 | + print( "mesh-doctor installed successfully." ) |
| 49 | + |
27 | 50 | # -- Project information ----------------------------------------------------- |
28 | 51 |
|
29 | 52 | project = u'GEOS Python Packages' |
30 | | -copyright = u'2018-2024 Lawrence Livermore National Security, The Board of Trustees of the Leland Stanford Junior University, TotalEnergies, and GEOSX Contributors.' |
| 53 | +copyright = u'2018-2025 Lawrence Livermore National Security, The Board of Trustees of the Leland Stanford Junior University, TotalEnergies, and GEOS Contributors.' |
31 | 54 | author = u'GEOS Contributors' |
32 | 55 |
|
33 | 56 | # The short X.Y version |
|
0 commit comments