setup.py 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #!/usr/bin/env python3
  2. # Copyright 2016 The Meson development team
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. # http://www.apache.org/licenses/LICENSE-2.0
  7. # Unless required by applicable law or agreed to in writing, software
  8. # distributed under the License is distributed on an "AS IS" BASIS,
  9. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. # See the License for the specific language governing permissions and
  11. # limitations under the License.
  12. import os
  13. import sys
  14. from distutils.dir_util import mkpath
  15. from distutils.file_util import copy_file
  16. from mesonbuild.coredata import version
  17. if sys.version_info[0] < 3:
  18. print('Tried to install with Python 2, Meson only supports Python 3.')
  19. sys.exit(1)
  20. # We need to support Python installations that have nothing but the basic
  21. # Python installation. Use setuptools when possible and fall back to
  22. # plain distutils when setuptools is not available.
  23. try:
  24. from setuptools import setup
  25. from setuptools.command.install_scripts import install_scripts as orig
  26. except ImportError:
  27. from distutils.core import setup
  28. from distutils.command.install_scripts import install_scripts as orig
  29. class install_scripts(orig):
  30. def run(self):
  31. if sys.platform == 'win32':
  32. super().run()
  33. return
  34. self.outfiles = []
  35. if not self.dry_run:
  36. mkpath(self.install_dir)
  37. # We want the files to be installed without a suffix on Unix
  38. for infile in self.get_inputs():
  39. in_stripped = infile[:-3] if infile.endswith('.py') else infile
  40. outfile = os.path.join(self.install_dir, in_stripped)
  41. # NOTE: Mode is preserved by default
  42. copy_file(infile, outfile, dry_run=self.dry_run)
  43. self.outfiles.append(outfile)
  44. setup(name='meson',
  45. version=version,
  46. description='A high performance build system',
  47. author='Jussi Pakkanen',
  48. author_email='jpakkane@gmail.com',
  49. url='http://mesonbuild.com',
  50. license=' Apache License, Version 2.0',
  51. packages=['mesonbuild',
  52. 'mesonbuild.modules',
  53. 'mesonbuild.scripts',
  54. 'mesonbuild.backend',
  55. 'mesonbuild.wrap'],
  56. scripts=['meson.py',
  57. 'mesonconf.py',
  58. 'mesontest.py',
  59. 'mesonintrospect.py',
  60. 'wraptool.py'],
  61. cmdclass={'install_scripts': install_scripts},
  62. data_files=[('share/man/man1', ['man/meson.1',
  63. 'man/mesonconf.1',
  64. 'man/mesonintrospect.1',
  65. 'man/mesontest.1',
  66. 'man/wraptool.1'])],
  67. classifiers=['Development Status :: 5 - Production/Stable',
  68. 'Environment :: Console',
  69. 'Intended Audience :: Developers',
  70. 'License :: OSI Approved :: Apache Software License',
  71. 'Natural Language :: English',
  72. 'Operating System :: MacOS :: MacOS X',
  73. 'Operating System :: Microsoft :: Windows',
  74. 'Operating System :: POSIX :: BSD',
  75. 'Operating System :: POSIX :: Linux',
  76. 'Programming Language :: Python :: 3 :: Only',
  77. 'Topic :: Software Development :: Build Tools',
  78. ],
  79. long_description='''Meson is a cross-platform build system designed to be both as
  80. fast and as user friendly as possible. It supports many languages and compilers, including
  81. GCC, Clang and Visual Studio. Its build definitions are written in a simple non-turing
  82. complete DSL.''')