-
Notifications
You must be signed in to change notification settings - Fork 5
/
setup.py
101 lines (78 loc) · 2.6 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
import os
import datetime
from distutils.core import setup
from distutils.extension import Extension
version='0.10.1'
# Allow us to specify a single extension to build.
ext_names = [
'_core',
'cipher',
'hash',
'mac',
'prng',
'rsa',
'pkcs1',
'pkcs5',
'ecc',
'utils',
]
ext_name = os.environ.get('PyTomCrypt_ext_name')
if ext_name:
if ext_name not in ext_names:
raise ValueError('unknown extension %r' % ext_name)
ext_names = [ext_name]
ext_modules = []
# Define the extensions
for name in ext_names:
ext_sources = []
ext_source_spec = 'src/%s.ext_sources.txt' % name
if os.path.exists(ext_source_spec):
for line in open(ext_source_spec):
line = line.strip()
if line and not line.startswith('#'):
ext_sources.append(line)
ext_modules.append(Extension(
'tomcrypt.%s' % name, ["tomcrypt/%s.c" % name] + ext_sources,
include_dirs=[
'.',
'./src',
'./vendor/patched/libtomcrypt',
'./vendor/libtomcrypt/src/headers',
'./vendor/libtommath',
],
define_macros=list(dict(
# These macros are needed for the math library.
LTM_DESC=None,
LTC_SOURCE=None,
PTC_VERSION='"%s"' % version,
).items()) if name == '_core' else [],
extra_compile_args=['-O3', '-funroll-loops', ]
))
# Go!
if __name__ == '__main__':
setup(
name='PyTomCrypt',
description='Python+Cython wrapper around LibTomCrypt',
version=version,
license='BSD-3',
platforms=['any'],
packages=['tomcrypt'],
author='Mike Boers',
author_email='[email protected]',
maintainer='Mike Boers',
maintainer_email='[email protected]',
url='http://github.com/mikeboers/PyTomCrypt',
classifiers = [
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: C',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 3',
'Topic :: Security :: Cryptography',
'Topic :: Software Development :: Libraries :: Python Modules',
],
ext_modules=ext_modules,
)