Debian Codegraph @

setup.py

raw
1 #!/usr/bin/env python
2 #
3 # Copyright (C) Jean-Paul Calderone 2008-2015, All rights reserved
4 #
5
6 """
7 Installation script for the OpenSSL package.
8 """
9
10 import os
11 import re
12
13 from setuptools import find_packages, setup
14
15 HERE = os.path.abspath(os.path.dirname(__file__))
16 META_PATH = os.path.join("src", "OpenSSL", "version.py")
17
18
19 def read_file(*parts):
20 """
21 Build an absolute path from *parts* and return the contents of the
22 resulting file. Assume UTF-8 encoding.
23 """
24 with open(os.path.join(HERE, *parts), encoding="utf-8", newline=None) as f:
25 return f.read()
26
27
28 META_FILE = read_file(META_PATH)
29
30
31 def find_meta(meta):
32 """
33 Extract __*meta*__ from META_FILE.
34 """
35 meta_match = re.search(
36 rf"^__{meta}__ = ['\"]([^'\"]*)['\"]", META_FILE, re.M
37 )
38 if meta_match:
39 return meta_match.group(1)
40 raise RuntimeError(f"Unable to find __{meta}__ string.")
41
42
43 URI = find_meta("uri")
44 LONG = (
45 read_file("README.rst")
46 + "\n\n"
47 + "Release Information\n"
48 + "===================\n\n"
49 + re.search(
50 r"(\d{2}.\d.\d \(.*?\)\n.*?)\n\n\n----\n",
51 read_file("CHANGELOG.rst"),
52 re.S,
53 ).group(1)
54 + "\n\n`Full changelog "
55 + "<{uri}en/stable/changelog.html>`_.\n\n"
56 ).format(uri=URI)
57
58
59 if __name__ == "__main__":
60 setup(
61 name=find_meta("title"),
62 version=find_meta("version"),
63 description=find_meta("summary"),
64 long_description=LONG,
65 author=find_meta("author"),
66 author_email=find_meta("email"),
67 url=URI,
68 project_urls={
69 "Source": "https://github.com/pyca/pyopenssl",
70 },
71 license=find_meta("license"),
72 classifiers=[
73 "Development Status :: 6 - Mature",
74 "Intended Audience :: Developers",
75 "License :: OSI Approved :: Apache Software License",
76 "Operating System :: MacOS :: MacOS X",
77 "Operating System :: Microsoft :: Windows",
78 "Operating System :: POSIX",
79 "Programming Language :: Python :: 3",
80 "Programming Language :: Python :: 3.9",
81 "Programming Language :: Python :: 3.10",
82 "Programming Language :: Python :: 3.11",
83 "Programming Language :: Python :: 3.12",
84 "Programming Language :: Python :: 3.13",
85 "Programming Language :: Python :: Implementation :: CPython",
86 "Programming Language :: Python :: Implementation :: PyPy",
87 "Topic :: Security :: Cryptography",
88 "Topic :: Software Development :: Libraries :: Python Modules",
89 "Topic :: System :: Networking",
90 ],
91 python_requires=">=3.9",
92 packages=find_packages(where="src"),
93 package_dir={"": "src"},
94 install_requires=[
95 "cryptography>=49.0.0,<51",
96 "typing-extensions>=4.9; python_version < '3.13'",
97 ],
98 extras_require={
99 "test": ["pytest-rerunfailures", "pretend", "pytest>=3.0.1"],
100 "docs": [
101 "sphinx!=5.2.0,!=5.2.0.post0,!=7.2.5",
102 "sphinx_rtd_theme",
103 ],
104 },
105 )