setup.py 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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 mesonbuild.coredata import version
  15. if sys.version_info < (3, 5, 0):
  16. print('Tried to install with an unsupported version of Python. '
  17. 'Meson requires Python 3.5.0 or greater')
  18. sys.exit(1)
  19. # We need to support Python installations that have nothing but the basic
  20. # Python installation. Use setuptools when possible and fall back to
  21. # plain distutils when setuptools is not available.
  22. try:
  23. from setuptools import setup
  24. from setuptools.command.install_scripts import install_scripts as orig
  25. except ImportError:
  26. from distutils.core import setup
  27. from distutils.command.install_scripts import install_scripts as orig
  28. class install_scripts(orig):
  29. def run(self):
  30. if sys.platform == 'win32':
  31. super().run()
  32. return
  33. if not self.skip_build:
  34. self.run_command('build_scripts')
  35. self.outfiles = []
  36. if not self.dry_run:
  37. self.mkpath(self.install_dir)
  38. # We want the files to be installed without a suffix on Unix
  39. for infile in self.get_inputs():
  40. infile = os.path.basename(infile)
  41. in_built = os.path.join(self.build_dir, infile)
  42. in_stripped = infile[:-3] if infile.endswith('.py') else infile
  43. outfile = os.path.join(self.install_dir, in_stripped)
  44. # NOTE: Mode is preserved by default
  45. self.copy_file(in_built, outfile)
  46. self.outfiles.append(outfile)
  47. setup(name='meson',
  48. version=version,
  49. description='A high performance build system',
  50. author='Jussi Pakkanen',
  51. author_email='jpakkane@gmail.com',
  52. url='http://mesonbuild.com',
  53. license=' Apache License, Version 2.0',
  54. python_requires='>=3.5',
  55. packages=['mesonbuild',
  56. 'mesonbuild.backend',
  57. 'mesonbuild.compilers',
  58. 'mesonbuild.dependencies',
  59. 'mesonbuild.modules',
  60. 'mesonbuild.scripts',
  61. 'mesonbuild.wrap'],
  62. scripts=['meson.py',
  63. 'mesonconf.py',
  64. 'mesontest.py',
  65. 'mesonintrospect.py',
  66. 'wraptool.py'],
  67. cmdclass={'install_scripts': install_scripts},
  68. data_files=[('share/man/man1', ['man/meson.1',
  69. 'man/mesonconf.1',
  70. 'man/mesonintrospect.1',
  71. 'man/mesontest.1',
  72. 'man/wraptool.1']),
  73. ('share/polkit-1/actions', ['data/com.mesonbuild.install.policy'])],
  74. classifiers=['Development Status :: 5 - Production/Stable',
  75. 'Environment :: Console',
  76. 'Intended Audience :: Developers',
  77. 'License :: OSI Approved :: Apache Software License',
  78. 'Natural Language :: English',
  79. 'Operating System :: MacOS :: MacOS X',
  80. 'Operating System :: Microsoft :: Windows',
  81. 'Operating System :: POSIX :: BSD',
  82. 'Operating System :: POSIX :: Linux',
  83. 'Programming Language :: Python :: 3 :: Only',
  84. 'Topic :: Software Development :: Build Tools',
  85. ],
  86. long_description='''Meson is a cross-platform build system designed to be both as
  87. fast and as user friendly as possible. It supports many languages and compilers, including
  88. GCC, Clang and Visual Studio. Its build definitions are written in a simple non-turing
  89. complete DSL.''')