setup.py 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. # Copyright 2015 Cloudera Inc.
  2. #
  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. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. # Parts of this file were taken from the pandas project
  15. # (https://github.com/pandas-dev/pandas), which is permitted for use under
  16. # the BSD 3-Clause License
  17. from distutils.sysconfig import get_config_var
  18. from distutils.version import LooseVersion
  19. import os
  20. import platform
  21. from setuptools import setup, Extension
  22. from Cython.Build import cythonize
  23. import sys
  24. # From https://github.com/pandas-dev/pandas/pull/24274:
  25. # For mac, ensure extensions are built for macos 10.9 when compiling on a
  26. # 10.9 system or above, overriding distuitls behaviour which is to target
  27. # the version that python was built for. This may be overridden by setting
  28. # MACOSX_DEPLOYMENT_TARGET before calling setup.py
  29. if sys.platform == 'darwin':
  30. if 'MACOSX_DEPLOYMENT_TARGET' not in os.environ:
  31. current_system = LooseVersion(platform.mac_ver()[0])
  32. python_target = LooseVersion(
  33. get_config_var('MACOSX_DEPLOYMENT_TARGET'))
  34. if python_target < '10.9' and current_system >= '10.9':
  35. os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.9'
  36. sasl_module = Extension('sasl.saslwrapper', ['sasl/saslwrapper.pyx'],
  37. include_dirs=["sasl"],
  38. libraries=["sasl2"],
  39. language="c++")
  40. setup(name='sasl',
  41. version='0.3.1+ada03f9f68a01416eb5689674672bca8140e14a7',
  42. url="http://github.com/cloudera/python-sasl",
  43. maintainer="Todd Lipcon",
  44. maintainer_email="todd@cloudera.com",
  45. description="""Cyrus-SASL bindings for Python""",
  46. classifiers=[
  47. 'Programming Language :: Python :: 2',
  48. 'Programming Language :: Python :: 3',
  49. ],
  50. packages=['sasl'],
  51. install_requires=['six'],
  52. ext_modules=cythonize([sasl_module]),
  53. include_package_data=True,
  54. license='Apache License, Version 2.0')