Skip to content

Commit

Permalink
TST: test the use of a custom meson.py script
Browse files Browse the repository at this point in the history
  • Loading branch information
rgommers committed Sep 10, 2023
1 parent 216c954 commit f2f842e
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/packages/vendored-meson/extra/pure.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# SPDX-FileCopyrightText: 2023 The meson-python developers
#
# SPDX-License-Identifier: MIT

def foo():
return 'bar'
13 changes: 13 additions & 0 deletions tests/packages/vendored-meson/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# SPDX-FileCopyrightText: 2023 The meson-python developers
#
# SPDX-License-Identifier: MIT

project('vendored-meson', version: '1.0.0')

py = import('python').find_installation()

py.install_sources('pure.py')

if get_option('custom-cli-used')
py.install_sources('extra/pure.py', subdir: 'extra')
endif
5 changes: 5 additions & 0 deletions tests/packages/vendored-meson/meson_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# SPDX-FileCopyrightText: 2023 The meson-python developers
#
# SPDX-License-Identifier: MIT

option('custom-cli-used', type: 'boolean', value: false)
6 changes: 6 additions & 0 deletions tests/packages/vendored-meson/pure.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# SPDX-FileCopyrightText: 2023 The meson-python developers
#
# SPDX-License-Identifier: MIT

def foo():
return 'bar'
10 changes: 10 additions & 0 deletions tests/packages/vendored-meson/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# SPDX-FileCopyrightText: 2023 The meson-python developers
#
# SPDX-License-Identifier: MIT

[build-system]
build-backend = 'mesonpy'
requires = ['meson-python']

[tool.meson-python]
cli = 'third-party/meson.py'
16 changes: 16 additions & 0 deletions tests/packages/vendored-meson/third-party/meson.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# SPDX-FileCopyrightText: 2023 The meson-python developers
#
# SPDX-License-Identifier: MIT

import sys
import pathlib

from mesonbuild import mesonmain


if 'setup' in sys.argv:
sys.argv.append('-Dcustom-cli-used=true')


if __name__ == '__main__':
sys.exit(mesonmain.main())
12 changes: 12 additions & 0 deletions tests/test_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,3 +333,15 @@ def test_install_subdir(wheel_install_subdir):
'nested/deep/deep.py',
'nested/nested.py',
}


def test_vendored_meson(wheel_vendored_meson):
artifact = wheel.wheelfile.WheelFile(wheel_vendored_meson)

assert wheel_contents(artifact) == {
'vendored_meson-1.0.0.dist-info/METADATA',
'vendored_meson-1.0.0.dist-info/RECORD',
'vendored_meson-1.0.0.dist-info/WHEEL',
'pure.py',
'extra/pure.py',
}

0 comments on commit f2f842e

Please sign in to comment.