Skip to content

Commit c0413f5

Browse files
committed
setup: Add tests for the installed files list
Ensure that the installed files list matches what we expect, to avoid surprises at release time.
1 parent 86298f2 commit c0413f5

File tree

2 files changed

+55
-35
lines changed

2 files changed

+55
-35
lines changed

run_meson_command_tests.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,22 @@ def test_meson_installed(self):
131131
os.environ['PYTHONPATH'] = str(pylibdir)
132132
os.environ['PATH'] = str(bindir) + os.pathsep + os.environ['PATH']
133133
self._run(python_command + ['setup.py', 'install', '--prefix', str(prefix)])
134-
self.assertTrue(pylibdir.is_dir())
134+
# Check that all the files were installed correctly
135135
self.assertTrue(bindir.is_dir())
136+
self.assertTrue(pylibdir.is_dir())
137+
from setup import packages
138+
# Extract list of expected python module files
139+
expect = set()
140+
for pkg in packages:
141+
expect.update([p.as_posix() for p in Path(pkg.replace('.', '/')).glob('*.py')])
142+
# Check what was installed, only count files that are inside 'mesonbuild'
143+
have = set()
144+
for p in Path(pylibdir).glob('**/*.py'):
145+
s = p.as_posix()
146+
if 'mesonbuild' not in s:
147+
continue
148+
have.add(s[s.rfind('mesonbuild'):])
149+
self.assertEqual(have, expect)
136150
# Run `meson`
137151
os.chdir('/')
138152
resolved_meson_command = [str(bindir / 'meson')]

setup.py

Lines changed: 40 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -28,38 +28,44 @@
2828
# On windows, will create Scripts/meson.exe and Scripts/meson-script.py
2929
# Other platforms will create bin/meson
3030
entries = {'console_scripts': ['meson=mesonbuild.mesonmain:main']}
31+
packages = ['mesonbuild',
32+
'mesonbuild.backend',
33+
'mesonbuild.compilers',
34+
'mesonbuild.dependencies',
35+
'mesonbuild.modules',
36+
'mesonbuild.scripts',
37+
'mesonbuild.wrap']
38+
data_files = []
39+
if sys.platform != 'win32':
40+
# Only useful on UNIX-like systems
41+
data_files = [('share/man/man1', ['man/meson.1']),
42+
('share/polkit-1/actions', ['data/com.mesonbuild.install.policy'])]
3143

32-
setup(name='meson',
33-
version=version,
34-
description='A high performance build system',
35-
author='Jussi Pakkanen',
36-
author_email='jpakkane@gmail.com',
37-
url='http://mesonbuild.com',
38-
license=' Apache License, Version 2.0',
39-
python_requires='>=3.5',
40-
packages=['mesonbuild',
41-
'mesonbuild.backend',
42-
'mesonbuild.compilers',
43-
'mesonbuild.dependencies',
44-
'mesonbuild.modules',
45-
'mesonbuild.scripts',
46-
'mesonbuild.wrap'],
47-
entry_points=entries,
48-
data_files=[('share/man/man1', ['man/meson.1']),
49-
('share/polkit-1/actions', ['data/com.mesonbuild.install.policy'])],
50-
classifiers=['Development Status :: 5 - Production/Stable',
51-
'Environment :: Console',
52-
'Intended Audience :: Developers',
53-
'License :: OSI Approved :: Apache Software License',
54-
'Natural Language :: English',
55-
'Operating System :: MacOS :: MacOS X',
56-
'Operating System :: Microsoft :: Windows',
57-
'Operating System :: POSIX :: BSD',
58-
'Operating System :: POSIX :: Linux',
59-
'Programming Language :: Python :: 3 :: Only',
60-
'Topic :: Software Development :: Build Tools',
61-
],
62-
long_description='''Meson is a cross-platform build system designed to be both as
63-
fast and as user friendly as possible. It supports many languages and compilers, including
64-
GCC, Clang and Visual Studio. Its build definitions are written in a simple non-turing
65-
complete DSL.''')
44+
if __name__ == '__main__':
45+
setup(name='meson',
46+
version=version,
47+
description='A high performance build system',
48+
author='Jussi Pakkanen',
49+
author_email='jpakkane@gmail.com',
50+
url='http://mesonbuild.com',
51+
license=' Apache License, Version 2.0',
52+
python_requires='>=3.5',
53+
packages=packages,
54+
entry_points=entries,
55+
data_files=data_files,
56+
classifiers=['Development Status :: 5 - Production/Stable',
57+
'Environment :: Console',
58+
'Intended Audience :: Developers',
59+
'License :: OSI Approved :: Apache Software License',
60+
'Natural Language :: English',
61+
'Operating System :: MacOS :: MacOS X',
62+
'Operating System :: Microsoft :: Windows',
63+
'Operating System :: POSIX :: BSD',
64+
'Operating System :: POSIX :: Linux',
65+
'Programming Language :: Python :: 3 :: Only',
66+
'Topic :: Software Development :: Build Tools',
67+
],
68+
long_description='''Meson is a cross-platform build system designed to be both as
69+
fast and as user friendly as possible. It supports many languages and compilers, including
70+
GCC, Clang and Visual Studio. Its build definitions are written in a simple non-turing
71+
complete DSL.''')

0 commit comments

Comments
 (0)