setup: Add tests for the installed files list

Ensure that the installed files list matches what we expect, to avoid
surprises at release time.
pull/4004/head
Nirbheek Chauhan 6 years ago
parent 86298f2109
commit c0413f5d49
  1. 16
      run_meson_command_tests.py
  2. 24
      setup.py

@ -131,8 +131,22 @@ class CommandTests(unittest.TestCase):
os.environ['PYTHONPATH'] = str(pylibdir)
os.environ['PATH'] = str(bindir) + os.pathsep + os.environ['PATH']
self._run(python_command + ['setup.py', 'install', '--prefix', str(prefix)])
self.assertTrue(pylibdir.is_dir())
# Check that all the files were installed correctly
self.assertTrue(bindir.is_dir())
self.assertTrue(pylibdir.is_dir())
from setup import packages
# Extract list of expected python module files
expect = set()
for pkg in packages:
expect.update([p.as_posix() for p in Path(pkg.replace('.', '/')).glob('*.py')])
# Check what was installed, only count files that are inside 'mesonbuild'
have = set()
for p in Path(pylibdir).glob('**/*.py'):
s = p.as_posix()
if 'mesonbuild' not in s:
continue
have.add(s[s.rfind('mesonbuild'):])
self.assertEqual(have, expect)
# Run `meson`
os.chdir('/')
resolved_meson_command = [str(bindir / 'meson')]

@ -28,7 +28,20 @@ from setuptools import setup
# On windows, will create Scripts/meson.exe and Scripts/meson-script.py
# Other platforms will create bin/meson
entries = {'console_scripts': ['meson=mesonbuild.mesonmain:main']}
packages = ['mesonbuild',
'mesonbuild.backend',
'mesonbuild.compilers',
'mesonbuild.dependencies',
'mesonbuild.modules',
'mesonbuild.scripts',
'mesonbuild.wrap']
data_files = []
if sys.platform != 'win32':
# Only useful on UNIX-like systems
data_files = [('share/man/man1', ['man/meson.1']),
('share/polkit-1/actions', ['data/com.mesonbuild.install.policy'])]
if __name__ == '__main__':
setup(name='meson',
version=version,
description='A high performance build system',
@ -37,16 +50,9 @@ setup(name='meson',
url='http://mesonbuild.com',
license=' Apache License, Version 2.0',
python_requires='>=3.5',
packages=['mesonbuild',
'mesonbuild.backend',
'mesonbuild.compilers',
'mesonbuild.dependencies',
'mesonbuild.modules',
'mesonbuild.scripts',
'mesonbuild.wrap'],
packages=packages,
entry_points=entries,
data_files=[('share/man/man1', ['man/meson.1']),
('share/polkit-1/actions', ['data/com.mesonbuild.install.policy'])],
data_files=data_files,
classifiers=['Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Intended Audience :: Developers',

Loading…
Cancel
Save