-
Notifications
You must be signed in to change notification settings - Fork 7
/
setup.py
84 lines (73 loc) · 2.51 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
#!/usr/bin/env python
"""Installer for Argon2 Python bindings"""
import sys
import platform
from setuptools import setup, Extension
INCLUDES = []
LIBRARY_DIRS = []
CFLAGS = []
if sys.platform.startswith('linux'):
DEFINE_MACROS = [('HAVE_CLOCK_GETTIME', '1'),
('HAVE_LIBRT', '1'),
('HAVE_POSIX_MEMALIGN', '1'),
('HAVE_STRUCT_SYSINFO', '1'),
('HAVE_STRUCT_SYSINFO_MEM_UNIT', '1'),
('HAVE_STRUCT_SYSINFO_TOTALRAM', '1'),
('HAVE_SYSINFO', '1'),
('HAVE_SYS_SYSINFO_H', '1'),
('_FILE_OFFSET_BITS', '64')]
LIBRARIES = []
CFLAGS.append('-O2')
elif sys.platform.startswith('win32'):
DEFINE_MACROS = [('inline', '__inline')]
LIBRARY_DIRS = [r'c:\OpenSSL-Win32\lib']
LIBRARIES = ['libeay32', 'advapi32']
INCLUDES = [r'c:\OpenSSL-Win32\include', 'argon2-windows-stubs/include']
elif sys.platform.startswith('darwin') and platform.mac_ver()[0] < '10.6':
DEFINE_MACROS = [('HAVE_SYSCTL_HW_USERMEM', '1')]
LIBRARIES = []
else:
DEFINE_MACROS = [('HAVE_POSIX_MEMALIGN', '1'),
('HAVE_SYSCTL_HW_USERMEM', '1')]
LIBRARIES = ['c_argon2']
ARGON2_MODULE = Extension(
'_argon2',
sources=[
'./src/argon2_py.c',
'./phc-winner-argon2/src/argon2.c',
'./phc-winner-argon2/src/core.c',
'./phc-winner-argon2/src/encoding.c',
'./phc-winner-argon2/src/ref.c',
'./phc-winner-argon2/src/thread.c',
'./phc-winner-argon2/src/blake2/blake2b.c',
],
include_dirs=[
'./phc-winner-argon2',
'./phc-winner-argon2/src',
'./phc-winner-argon2/src/blake2',
] + INCLUDES,
define_macros=[('HAVE_CONFIG_H', None)] + DEFINE_MACROS,
extra_compile_args=CFLAGS,
library_dirs=LIBRARY_DIRS,
libraries=LIBRARIES)
setup(
name='argon2',
version='0.1.10',
description='Bindings for the argon2 password hasher',
author='Moroz Ilya',
author_email='[email protected]',
url='https://github.com/flamewow/argon2_py',
py_modules=['argon2'],
ext_modules=[ARGON2_MODULE],
packages=['phc-winner-argon2'],
classifiers=(
'Development Status :: 4 - Beta',
'Environment :: Console',
'License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication',
'Operating System :: POSIX',
'Operating System :: Unix',
'Programming Language :: Python',
),
license="CC0",
test_suite='tests',
)