-
Notifications
You must be signed in to change notification settings - Fork 454
/
setup.py
109 lines (93 loc) · 3.98 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
import sys
from os import path, listdir
from pathlib import Path
from typing import List, Tuple, Dict
from setuptools import find_packages
# Setup file based on https://github.com/pypa/sampleproject/blob/master/setup.py
root_path = Path(__file__).parent.absolute()
# For cx_freeze builds, we need a special setup() function
if len(sys.argv) > 1 and sys.argv[1] == "build_exe":
from cx_Freeze import setup
from cx_Freeze import Executable
else:
from setuptools import setup
# Create fake Executable that does nothing so the setup.py file can be used on Linux
class Executable: # type: ignore
def __init__(self, script, target_name): # type: ignore
pass
def get_long_description() -> str:
path_to_readme = root_path / "README.md"
return path_to_readme.read_text()
def get_project_info() -> Dict[str, str]:
project_info: Dict[str, str] = {}
project_info_path = root_path / "sslyze" / "__version__.py"
exec(project_info_path.read_text(), project_info)
return project_info
def get_include_files() -> List[Tuple[str, str]]:
""" "Get the list of non-Python files to package when doing a cx_freeze build."""
non_python_files = []
# The trust stores
trust_stores_pem_path = root_path / "sslyze" / "plugins" / "certificate_info" / "trust_stores" / "pem_files"
for file in listdir(trust_stores_pem_path):
file = path.join(trust_stores_pem_path, file)
if path.isfile(file): # skip directories
filename = path.basename(file)
non_python_files.append((file, path.join("pem_files", filename)))
# The Mozilla profile
mozilla_profile_path = root_path / "sslyze" / "mozilla_tls_profile" / "5.7.json"
non_python_files.append((str(mozilla_profile_path), mozilla_profile_path.name))
return non_python_files
project_info = get_project_info()
setup(
name=project_info["__title__"].lower(),
version=project_info["__version__"],
description=project_info["__description__"],
url=project_info["__url__"],
author=project_info["__author__"],
author_email=project_info["__author_email__"],
license=project_info["__license__"],
python_requires=">=3.8",
# Pypi metadata
long_description=get_long_description(),
long_description_content_type="text/markdown",
classifiers=[
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: System Administrators",
"Natural Language :: French",
"License :: OSI Approved :: GNU Affero General Public License v3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: System :: Networking",
"Topic :: System :: Monitoring",
"Topic :: System :: Networking :: Monitoring",
"Topic :: Security",
],
keywords="ssl tls scan security library",
project_urls={
"Source": "https://github.com/nabla-c0d3/sslyze",
"Changelog": "https://github.com/nabla-c0d3/sslyze/releases",
"Documentation": "https://nabla-c0d3.github.io/sslyze/documentation",
},
# Package info
packages=find_packages(include=["sslyze", "sslyze.*"]),
package_data={
"sslyze": ["py.typed"],
"sslyze.plugins.certificate_info.trust_stores": ["pem_files/*.pem", "pem_files/*.yaml"],
"sslyze.mozilla_tls_profile": ["5.7.json"],
},
entry_points={"console_scripts": ["sslyze = sslyze.__main__:main"]},
# Dependencies
install_requires=[
"nassl>=5.1,<6",
"cryptography>42,<43",
"tls-parser>=2,<3",
"pydantic>=2.2,<2.7",
],
# cx_freeze info for Windows builds with Python embedded
options={"build_exe": {"packages": ["cffi", "cryptography"], "include_files": get_include_files()}},
executables=[Executable(path.join("sslyze", "__main__.py"), target_name="sslyze.exe")],
)