setup.py 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #!/usr/bin/env python
  2. '''
  3. Licensed to the Apache Software Foundation (ASF) under one
  4. or more contributor license agreements. See the NOTICE file
  5. distributed with this work for additional information
  6. regarding copyright ownership. The ASF licenses this file
  7. to you under the Apache License, Version 2.0 (the
  8. "License"); you may not use this file except in compliance
  9. with the License. You may obtain a copy of the License at
  10. http://www.apache.org/licenses/LICENSE-2.0
  11. Unless required by applicable law or agreed to in writing, software
  12. distributed under the License is distributed on an "AS IS" BASIS,
  13. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. See the License for the specific language governing permissions and
  15. limitations under the License.
  16. '''
  17. import os
  18. from os.path import dirname
  19. from setuptools import find_packages, setup
  20. AMBARI_COMMON_PYTHON_FOLDER = "ambari-common/src/main/python"
  21. AMBARI_SERVER_TEST_PYTHON_FOLDER = "ambari-server/src/test/python"
  22. def get_ambari_common_packages():
  23. return find_packages(AMBARI_COMMON_PYTHON_FOLDER, exclude=["*.tests", "*.tests.*", "tests.*", "tests"])
  24. def get_ambari_server_stack_package():
  25. return ["stacks.utils"]
  26. def get_extra_common_packages():
  27. return ["urlinfo_processor", "ambari_jinja2", "ambari_jinja2._markupsafe"]
  28. def create_package_dir_map():
  29. package_dirs = {}
  30. ambari_common_packages = get_ambari_common_packages()
  31. for ambari_common_package in ambari_common_packages:
  32. package_dirs[ambari_common_package] = AMBARI_COMMON_PYTHON_FOLDER + '/' + ambari_common_package.replace(".", "/")
  33. ambari_server_packages = get_ambari_server_stack_package()
  34. for ambari_server_package in ambari_server_packages:
  35. package_dirs[ambari_server_package] = AMBARI_SERVER_TEST_PYTHON_FOLDER + '/' + ambari_server_package.replace(".", "/")
  36. package_dirs["ambari_jinja2"] = AMBARI_COMMON_PYTHON_FOLDER + "/ambari_jinja2/ambari_jinja2"
  37. package_dirs["ambari_jinja2._markupsafe"] = AMBARI_COMMON_PYTHON_FOLDER + "/ambari_jinja2/ambari_jinja2/_markupsafe"
  38. package_dirs["urlinfo_processor"] = AMBARI_COMMON_PYTHON_FOLDER + "/urlinfo_processor"
  39. return package_dirs
  40. __version__ = "3.0.0.dev0"
  41. def get_version():
  42. ambari_version = os.environ["AMBARI_VERSION"] if "AMBARI_VERSION" in os.environ else __version__
  43. print ambari_version
  44. return ambari_version
  45. """
  46. Example usage:
  47. - build package with specific version:
  48. python setup.py sdist -d "my/dist/location"
  49. - build and install package with specific version:
  50. python setup.py sdist -d "my/dist/location" install
  51. - build and upload package with specific version:
  52. python setup.py sdist -d "my/dist/location" upload -r "http://localhost:8080"
  53. Installing from pip:
  54. - pip install --extra-index-url=http://localhost:8080 ambari-python==2.7.1 // 3.0.0.dev0 is the snapshot version
  55. Note: using 'export AMBARI_VERSION=2.7.1' before commands you can redefine the package version, but you will need this export during the pip install as well
  56. """
  57. setup(
  58. name = "ambari-python",
  59. version = get_version(),
  60. author = "Apache Software Foundation",
  61. author_email = "dev@ambari.apache.org",
  62. description = ("Framework for provison/manage/monitor Hadoop clusters"),
  63. license = "AP2",
  64. keywords = "hadoop, ambari",
  65. url = "https://ambari.apache.org",
  66. packages = get_ambari_common_packages() + get_ambari_server_stack_package() + get_extra_common_packages(),
  67. package_dir = create_package_dir_map(),
  68. install_requires=[
  69. 'mock==1.0.1',
  70. 'coilmq==1.0.1'
  71. ],
  72. include_package_data = True,
  73. long_description="The Apache Ambari project is aimed at making Hadoop management simpler by developing software for provisioning, managing, and monitoring Apache Hadoop clusters. "
  74. "Ambari provides an intuitive, easy-to-use Hadoop management web UI backed by its RESTful APIs."
  75. )