setup.py 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/usr/bin/python2
  2. from distutils.core import setup, Extension
  3. from os import getenv
  4. from distutils.command.build_ext import build_ext as _build_ext
  5. from distutils.command.install_lib import install_lib as _install_lib
  6. class build_ext(_build_ext):
  7. def finalize_options(self):
  8. _build_ext.finalize_options(self)
  9. self.build_lib = build_lib
  10. self.build_temp = build_tmp
  11. class install_lib(_install_lib):
  12. def finalize_options(self):
  13. _install_lib.finalize_options(self)
  14. self.build_dir = build_lib
  15. cflags = getenv('CFLAGS', '').split()
  16. # switch off several checks (need to be at the end of cflags list)
  17. cflags += ['-fno-strict-aliasing', '-Wno-write-strings', '-Wno-unused-parameter' ]
  18. build_lib = getenv('PYTHON_EXTBUILD_LIB')
  19. build_tmp = getenv('PYTHON_EXTBUILD_TMP')
  20. libtraceevent = getenv('LIBTRACEEVENT')
  21. libapikfs = getenv('LIBAPI')
  22. ext_sources = [f.strip() for f in file('util/python-ext-sources')
  23. if len(f.strip()) > 0 and f[0] != '#']
  24. perf = Extension('perf',
  25. sources = ext_sources,
  26. include_dirs = ['util/include'],
  27. extra_compile_args = cflags,
  28. extra_objects = [libtraceevent, libapikfs],
  29. )
  30. setup(name='perf',
  31. version='0.1',
  32. description='Interface with the Linux profiling infrastructure',
  33. author='Arnaldo Carvalho de Melo',
  34. author_email='acme@redhat.com',
  35. license='GPLv2',
  36. url='http://perf.wiki.kernel.org',
  37. ext_modules=[perf],
  38. cmdclass={'build_ext': build_ext, 'install_lib': install_lib})