setup.py 3.9 KB

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