blob: fbd65712ba2056876cbdfaaa171f2b2a6fa918cc [file] [log] [blame]
Jean-Paul Calderonecf20dd62008-06-12 16:38:38 -04001#!/usr/bin/env python
Jean-Paul Calderone0db6cdb2008-04-11 11:52:15 -04002# -*- coding: utf-8 -*-
Jean-Paul Calderone897bc252008-02-18 20:50:23 -05003#
Hynek Schlawack76ecf942015-04-14 11:09:44 -04004# Copyright (C) Jean-Paul Calderone 2008-2015, All rights reserved
Jean-Paul Calderone897bc252008-02-18 20:50:23 -05005#
Jean-Paul Calderonee53ccf72008-04-11 11:40:39 -04006
Jean-Paul Calderone897bc252008-02-18 20:50:23 -05007"""
Hynek Schlawackf90e3682016-03-11 11:21:13 +01008Installation script for the OpenSSL package.
Jean-Paul Calderone897bc252008-02-18 20:50:23 -05009"""
10
Hynek Schlawack5bc17cb2015-04-30 19:21:40 +020011import codecs
12import os
13import re
Hynek Schlawackf982efd2015-04-15 12:08:54 -040014
Hynek Schlawackf0e66852015-10-16 20:18:38 +020015from setuptools import setup, find_packages
Jean-Paul Calderone897bc252008-02-18 20:50:23 -050016
Hynek Schlawack76ecf942015-04-14 11:09:44 -040017
Hynek Schlawack5bc17cb2015-04-30 19:21:40 +020018HERE = os.path.abspath(os.path.dirname(__file__))
Hynek Schlawackf0e66852015-10-16 20:18:38 +020019META_PATH = os.path.join("src", "OpenSSL", "version.py")
Hynek Schlawack5bc17cb2015-04-30 19:21:40 +020020
21
22def read_file(*parts):
23 """
24 Build an absolute path from *parts* and and return the contents of the
25 resulting file. Assume UTF-8 encoding.
26 """
27 with codecs.open(os.path.join(HERE, *parts), "rb", "ascii") as f:
28 return f.read()
29
30
31META_FILE = read_file(META_PATH)
32
33
34def find_meta(meta):
35 """
36 Extract __*meta*__ from META_FILE.
37 """
38 meta_match = re.search(
Alex Gaynor03737182020-07-23 20:40:46 -040039 r"^__{meta}__ = ['\"]([^'\"]*)['\"]".format(meta=meta), META_FILE, re.M
Hynek Schlawack5bc17cb2015-04-30 19:21:40 +020040 )
41 if meta_match:
42 return meta_match.group(1)
43 raise RuntimeError("Unable to find __{meta}__ string.".format(meta=meta))
Jean-Paul Calderone897bc252008-02-18 20:50:23 -050044
Hynek Schlawackf982efd2015-04-15 12:08:54 -040045
Hynek Schlawack65e4def2016-03-13 15:07:52 +010046URI = find_meta("uri")
47LONG = (
Alex Gaynor03737182020-07-23 20:40:46 -040048 read_file("README.rst")
49 + "\n\n"
50 + "Release Information\n"
51 + "===================\n\n"
52 + re.search(
53 r"(\d{2}.\d.\d \(.*?\)\n.*?)\n\n\n----\n",
54 read_file("CHANGELOG.rst"),
55 re.S,
56 ).group(1)
57 + "\n\n`Full changelog "
58 + "<{uri}en/stable/changelog.html>`_.\n\n"
Hynek Schlawack65e4def2016-03-13 15:07:52 +010059).format(uri=URI)
60
61
Hynek Schlawackf0e66852015-10-16 20:18:38 +020062if __name__ == "__main__":
63 setup(
64 name=find_meta("title"),
65 version=find_meta("version"),
66 description=find_meta("summary"),
Hynek Schlawack65e4def2016-03-13 15:07:52 +010067 long_description=LONG,
Hynek Schlawackf0e66852015-10-16 20:18:38 +020068 author=find_meta("author"),
69 author_email=find_meta("email"),
Hynek Schlawack65e4def2016-03-13 15:07:52 +010070 url=URI,
Hynek Schlawackf0e66852015-10-16 20:18:38 +020071 license=find_meta("license"),
72 classifiers=[
Alex Gaynor03737182020-07-23 20:40:46 -040073 "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 :: 2",
80 "Programming Language :: Python :: 2.7",
81 "Programming Language :: Python :: 3",
82 "Programming Language :: Python :: 3.5",
83 "Programming Language :: Python :: 3.6",
84 "Programming Language :: Python :: 3.7",
85 "Programming Language :: Python :: 3.8",
Paul Kehrerde2dbf72020-11-27 15:47:04 -060086 "Programming Language :: Python :: 3.9",
Alex Gaynor03737182020-07-23 20:40:46 -040087 "Programming Language :: Python :: Implementation :: CPython",
88 "Programming Language :: Python :: Implementation :: PyPy",
89 "Topic :: Security :: Cryptography",
90 "Topic :: Software Development :: Libraries :: Python Modules",
91 "Topic :: System :: Networking",
Hynek Schlawackf0e66852015-10-16 20:18:38 +020092 ],
Alex Gaynor03737182020-07-23 20:40:46 -040093 python_requires=">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*",
Hynek Schlawackf0e66852015-10-16 20:18:38 +020094 packages=find_packages(where="src"),
95 package_dir={"": "src"},
96 install_requires=[
Hynek Schlawack73412e52016-03-16 13:37:05 +010097 # Fix cryptographyMinimum in tox.ini when changing this!
Alex Gaynor124a0132020-10-27 00:15:17 -040098 "cryptography>=3.2",
Alex Gaynor03737182020-07-23 20:40:46 -040099 "six>=1.5.2",
Hynek Schlawackf0e66852015-10-16 20:18:38 +0200100 ],
Paul Kehrer4fbc11d2017-07-06 23:00:14 -0500101 extras_require={
Alex Gaynor03737182020-07-23 20:40:46 -0400102 "test": ["flaky", "pretend", "pytest>=3.0.1"],
103 "docs": ["sphinx", "sphinx_rtd_theme"],
Paul Kehrer4fbc11d2017-07-06 23:00:14 -0500104 },
Hynek Schlawackf0e66852015-10-16 20:18:38 +0200105 )