Skip to content

Commit

Permalink
Pass the build-extensions option directly to Meson from RTD
Browse files Browse the repository at this point in the history
  • Loading branch information
TeamSpen210 committed Jan 25, 2025
1 parent 06a5439 commit 3ae936f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 15 deletions.
11 changes: 8 additions & 3 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,20 @@ version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-20.04
os: ubuntu-24.04
tools:
python: "3.11"
python: "3.13"
jobs:
post_install:
# We just need to pass -config-settings, others are what RTD does by default.
- python -m pip install -upgrade-strategy only-if-needed --no-cache-dir -config-settings=setup-args="-Dbuild_extensions=false" .

# Install the package.
python:
install:
- method: pip
path: .
# Can't use path, want to disable meson building extensions.
# path: .
- requirements: docs-requirements.txt

# Build documentation in the docs/ directory with Sphinx
Expand Down
12 changes: 1 addition & 11 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,7 @@ fs = import('fs')
py = import('python').find_installation(pure: false)
dep_py = py.dependency()

build_extensions = get_option('build_extensions')
summary({'option': build_extensions}, section: 'Build C Extensions')

# Can't check environment variables directly, need to launch Python.
res = run_command(py, '-c', 'import os; print("READTHEDOCS" in os.environ)', check: true)
if res.returncode() == 0 and 'True' in res.stdout()
build_extensions = false
endif
summary({'stdout': res.stdout(), 'build': build_extensions}, section: 'Build C Extensions')

if build_extensions
if get_option('build_extensions')
# Build quickhull.
inc_quickhull = include_directories('src' / 'quickhull')
lib_quickhull = static_library(
Expand Down
2 changes: 1 addition & 1 deletion src/srctools/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ py.install_sources(pure_python, subdir: 'srctools')
subdir('_pyinstaller')
subdir('scripts')

if build_extensions
if get_option('build_extensions')
py.extension_module(
'_math',
files(
Expand Down

0 comments on commit 3ae936f

Please sign in to comment.