setup.py 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 os
  16. from setuptools import setup, find_packages
  17. here = os.path.abspath(os.path.dirname(__file__))
  18. def read_file(path_segments):
  19. """Read a file from the package. Takes a list of strings to join to
  20. make the path"""
  21. file_path = os.path.join(here, *path_segments)
  22. with open(file_path) as f:
  23. return f.read()
  24. def exec_file(path_segments):
  25. """Execute a single python file to get the variables defined in it"""
  26. result = {}
  27. code = read_file(path_segments)
  28. exec(code, result)
  29. return result
  30. version = exec_file(("synapse", "__init__.py"))["__version__"]
  31. dependencies = exec_file(("synapse", "python_dependencies.py"))
  32. long_description = read_file(("README.rst",))
  33. setup(
  34. name="matrix-synapse",
  35. version=version,
  36. packages=find_packages(exclude=["tests", "tests.*"]),
  37. description="Reference Synapse Home Server",
  38. install_requires=dependencies['requirements'](include_conditional=True).keys(),
  39. setup_requires=[
  40. "Twisted==14.0.2", # Here to override setuptools_trial's dependency on Twisted>=2.4.0
  41. "setuptools_trial",
  42. "mock"
  43. ],
  44. dependency_links=dependencies["DEPENDENCY_LINKS"],
  45. include_package_data=True,
  46. zip_safe=False,
  47. long_description=long_description,
  48. scripts=["synctl", "register_new_matrix_user"],
  49. )