aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2018-08-12 00:55:04 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2018-08-12 01:18:58 +0530
commitc0413f5d49ce7b7df03cf859841aa8b275a6cd6d (patch)
tree287c25cd3f04838be712b8de4263e48a34f5ae47
parent86298f2109d215ad6b26d3462af7b685d52d0dd7 (diff)
downloadmeson-c0413f5d49ce7b7df03cf859841aa8b275a6cd6d.zip
meson-c0413f5d49ce7b7df03cf859841aa8b275a6cd6d.tar.gz
meson-c0413f5d49ce7b7df03cf859841aa8b275a6cd6d.tar.bz2
setup: Add tests for the installed files list
Ensure that the installed files list matches what we expect, to avoid surprises at release time.
-rwxr-xr-xrun_meson_command_tests.py16
-rw-r--r--setup.py74
2 files changed, 55 insertions, 35 deletions
diff --git a/run_meson_command_tests.py b/run_meson_command_tests.py
index f38b89a..4a05b94 100755
--- a/run_meson_command_tests.py
+++ b/run_meson_command_tests.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')]
diff --git a/setup.py b/setup.py
index b11d8a2..41933cb 100644
--- a/setup.py
+++ b/setup.py
@@ -28,38 +28,44 @@ 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'])]
-setup(name='meson',
- version=version,
- description='A high performance build system',
- author='Jussi Pakkanen',
- author_email='jpakkane@gmail.com',
- 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'],
- entry_points=entries,
- data_files=[('share/man/man1', ['man/meson.1']),
- ('share/polkit-1/actions', ['data/com.mesonbuild.install.policy'])],
- classifiers=['Development Status :: 5 - Production/Stable',
- 'Environment :: Console',
- 'Intended Audience :: Developers',
- 'License :: OSI Approved :: Apache Software License',
- 'Natural Language :: English',
- 'Operating System :: MacOS :: MacOS X',
- 'Operating System :: Microsoft :: Windows',
- 'Operating System :: POSIX :: BSD',
- 'Operating System :: POSIX :: Linux',
- 'Programming Language :: Python :: 3 :: Only',
- 'Topic :: Software Development :: Build Tools',
- ],
- long_description='''Meson is a cross-platform build system designed to be both as
-fast and as user friendly as possible. It supports many languages and compilers, including
-GCC, Clang and Visual Studio. Its build definitions are written in a simple non-turing
-complete DSL.''')
+if __name__ == '__main__':
+ setup(name='meson',
+ version=version,
+ description='A high performance build system',
+ author='Jussi Pakkanen',
+ author_email='jpakkane@gmail.com',
+ url='http://mesonbuild.com',
+ license=' Apache License, Version 2.0',
+ python_requires='>=3.5',
+ packages=packages,
+ entry_points=entries,
+ data_files=data_files,
+ classifiers=['Development Status :: 5 - Production/Stable',
+ 'Environment :: Console',
+ 'Intended Audience :: Developers',
+ 'License :: OSI Approved :: Apache Software License',
+ 'Natural Language :: English',
+ 'Operating System :: MacOS :: MacOS X',
+ 'Operating System :: Microsoft :: Windows',
+ 'Operating System :: POSIX :: BSD',
+ 'Operating System :: POSIX :: Linux',
+ 'Programming Language :: Python :: 3 :: Only',
+ 'Topic :: Software Development :: Build Tools',
+ ],
+ long_description='''Meson is a cross-platform build system designed to be both as
+ fast and as user friendly as possible. It supports many languages and compilers, including
+ GCC, Clang and Visual Studio. Its build definitions are written in a simple non-turing
+ complete DSL.''')