-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
57 lines (46 loc) · 1.47 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
#!/usr/bin/env python
import glob
import os
from pathlib import Path
import sys
if sys.version_info < (3, 9, 0):
sys.stderr.write("ERROR: You need Python 3.9 or later to use slh-dsa yet.\n")
exit(1)
from setuptools import Extension, find_packages, setup
try:
import tomllib
except ModuleNotFoundError:
import tomli as tomllib
if os.getenv('SLHDSA_BUILD_OPTIMIZED', '1') == '1':
mypyc_targets = []
print('Building Optimized Library')
for pth in Path('slhdsa').glob('**/*.py'):
if pth.name != '__init__.py':
mypyc_targets.append(pth.as_posix().replace('/', os.sep))
from mypyc.build import mypycify
ext_modules = mypycify(
mypyc_targets,
opt_level = "3",
debug_level = "1"
)
else:
ext_modules = []
metadata = tomllib.load(open('pyproject.toml', 'rb'))['project']
setup(
name = "slhdsa",
version = metadata['version'],
description = metadata['description'],
long_description = open('README.md', encoding='utf8').read(),
author = metadata["authors"][0]["name"],
author_email = metadata["authors"][0]["email"],
url = metadata["urls"]["Homepage"],
license = metadata["license"],
py_modules = [],
ext_modules = ext_modules,
packages = find_packages(),
classifiers = metadata["classifiers"],
install_requires = metadata["dependencies"],
python_requires = metadata["requires-python"],
include_package_data = True,
project_urls = metadata["urls"],
)