setup.py 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #!/usr/bin/env python
  2. # Copyright 2014 OpenMarket Ltd
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. import glob
  16. import os
  17. from setuptools import setup, find_packages
  18. here = os.path.abspath(os.path.dirname(__file__))
  19. def read_file(path_segments):
  20. """Read a file from the package. Takes a list of strings to join to
  21. make the path"""
  22. file_path = os.path.join(here, *path_segments)
  23. with open(file_path) as f:
  24. return f.read()
  25. def exec_file(path_segments):
  26. """Execute a single python file to get the variables defined in it"""
  27. result = {}
  28. code = read_file(path_segments)
  29. exec(code, result)
  30. return result
  31. version = exec_file(("synapse", "__init__.py"))["__version__"]
  32. dependencies = exec_file(("synapse", "python_dependencies.py"))
  33. long_description = read_file(("README.rst",))
  34. setup(
  35. name="matrix-synapse",
  36. version=version,
  37. packages=find_packages(exclude=["tests", "tests.*"]),
  38. description="Reference Synapse Home Server",
  39. install_requires=dependencies['requirements'](include_conditional=True).keys(),
  40. setup_requires=[
  41. "Twisted==14.0.2", # Here to override setuptools_trial's dependency on Twisted>=2.4.0
  42. "setuptools_trial",
  43. "mock"
  44. ],
  45. dependency_links=dependencies["DEPENDENCY_LINKS"],
  46. include_package_data=True,
  47. zip_safe=False,
  48. long_description=long_description,
  49. scripts=["synctl"] + glob.glob("scripts/*"),
  50. )