setup.py 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. # Copyright (C) Jean-Paul Calderone 2008-2015, All rights reserved
  5. #
  6. """
  7. Installation script for the OpenSSL package.
  8. """
  9. import codecs
  10. import os
  11. import re
  12. from setuptools import setup, find_packages
  13. HERE = os.path.abspath(os.path.dirname(__file__))
  14. META_PATH = os.path.join("src", "OpenSSL", "version.py")
  15. def read_file(*parts):
  16. """
  17. Build an absolute path from *parts* and and return the contents of the
  18. resulting file. Assume UTF-8 encoding.
  19. """
  20. with codecs.open(os.path.join(HERE, *parts), "rb", "ascii") as f:
  21. return f.read()
  22. META_FILE = read_file(META_PATH)
  23. def find_meta(meta):
  24. """
  25. Extract __*meta*__ from META_FILE.
  26. """
  27. meta_match = re.search(
  28. r"^__{meta}__ = ['\"]([^'\"]*)['\"]".format(meta=meta),
  29. META_FILE, re.M
  30. )
  31. if meta_match:
  32. return meta_match.group(1)
  33. raise RuntimeError("Unable to find __{meta}__ string.".format(meta=meta))
  34. URI = find_meta("uri")
  35. LONG = (
  36. read_file("README.rst") + "\n\n" +
  37. "Release Information\n" +
  38. "===================\n\n" +
  39. re.search("(\d{2}.\d.\d \(.*?\)\n.*?)\n\n\n----\n",
  40. read_file("CHANGELOG.rst"), re.S).group(1) +
  41. "\n\n`Full changelog " +
  42. "<{uri}en/stable/changelog.html>`_.\n\n"
  43. ).format(uri=URI)
  44. if __name__ == "__main__":
  45. setup(
  46. name=find_meta("title"),
  47. version=find_meta("version"),
  48. description=find_meta("summary"),
  49. long_description=LONG,
  50. author=find_meta("author"),
  51. author_email=find_meta("email"),
  52. maintainer="Hynek Schlawack",
  53. maintainer_email="hs@ox.cx",
  54. url=URI,
  55. license=find_meta("license"),
  56. classifiers=[
  57. 'Development Status :: 6 - Mature',
  58. 'Intended Audience :: Developers',
  59. 'License :: OSI Approved :: Apache Software License',
  60. 'Operating System :: MacOS :: MacOS X',
  61. 'Operating System :: Microsoft :: Windows',
  62. 'Operating System :: POSIX',
  63. 'Programming Language :: Python :: 2',
  64. 'Programming Language :: Python :: 2.6',
  65. 'Programming Language :: Python :: 2.7',
  66. 'Programming Language :: Python :: 3',
  67. 'Programming Language :: Python :: 3.4',
  68. 'Programming Language :: Python :: 3.5',
  69. 'Programming Language :: Python :: 3.6',
  70. 'Programming Language :: Python :: Implementation :: CPython',
  71. 'Programming Language :: Python :: Implementation :: PyPy',
  72. 'Topic :: Security :: Cryptography',
  73. 'Topic :: Software Development :: Libraries :: Python Modules',
  74. 'Topic :: System :: Networking',
  75. ],
  76. packages=find_packages(where="src"),
  77. package_dir={"": "src"},
  78. install_requires=[
  79. # Fix cryptographyMinimum in tox.ini when changing this!
  80. "cryptography>=2.1.4",
  81. "six>=1.5.2"
  82. ],
  83. extras_require={
  84. "test": [
  85. "flaky",
  86. "pretend",
  87. # pytest 3.3 doesn't support Python 2.6 anymore.
  88. # Remove this pin once we drop Python 2.6 too.
  89. "pytest>=3.0.1,<3.3.0",
  90. ],
  91. "docs": [
  92. "sphinx",
  93. "sphinx_rtd_theme",
  94. ]
  95. },
  96. )