-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsetup.py
194 lines (178 loc) · 6.05 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
"""
Main entrypoint for building the openGPMP Python API.
Leverages SWIG, setuptools, and a few other dependencies.
"""
# from setuptools import setup, find_packages
import setuptools
from setuptools import setup, dist
from setuptools.extension import Extension
from setuptools.command.install import install
from setuptools.command.build_ext import build_ext
import os
import subprocess
import platform
import urllib.request
import json
import versioneer
this_dir = os.path.dirname(os.path.abspath(__file__))
CXX_ARGS = ['-D',
'__GPMP_PYTHON_API__',
'-std=c++20',
'-Wparentheses',
'-Wsign-compare',
'-DNDEBUG',
'-Wall',
'-Wextra',
'-march=native'
]
# arithmetic module related information
arithmetic = Extension(
'pygpmp.arithmetic._arithmetic',
include_dirs=[os.path.join(this_dir, 'include/arithmetic')],
sources=[
'pygpmp/arithmetic/arithmetic.i',
'modules/arithmetic/arith.cpp'],
extra_compile_args=['-std=c++20'],
swig_opts=['-Wall', '-c++'],
)
# calculus module related information
calculus = Extension(
'pygpmp.calculus._calculus',
include_dirs=[os.path.join(this_dir, 'include/calculus')],
sources=[
'pygpmp/calculus/calculus.i',
'modules/calculus/differential.cpp'],
extra_compile_args=CXX_ARGS,
swig_opts=['-c++'],
)
core = Extension(
'pygpmp.core._core',
include_dirs=[os.path.join(this_dir, 'include/core')],
sources=[
'pygpmp/core/core.i',
'modules/core/datatable.cpp',
'modules/core/utils.cpp',
],
extra_compile_args=CXX_ARGS,
swig_opts=['-c++'],
)
# machine learning module related information
ml = Extension(
'pygpmp.ml._ml',
include_dirs=[os.path.join(this_dir, 'include/ml')],
sources=[
'pygpmp/ml/ml.i',
'modules/ml/linreg.cpp'],
extra_compile_args=CXX_ARGS,
swig_opts=['-c++'],
)
# linear algebra module related information
linalg = Extension(
'pygpmp.linalg._linalg',
include_dirs=[os.path.join(this_dir, 'include/linalg')],
sources=[
'pygpmp/linalg/linalg.i',
'modules/linalg/mtx.cpp'],
extra_compile_args=CXX_ARGS,
swig_opts=['-c++'],
)
# number_theory module related information
nt = Extension(
'pygpmp.nt._nt',
include_dirs=[os.path.join(this_dir, 'include/nt')],
sources=[
'pygpmp/nt/nt.i',
'modules/arithmetic/arith.cpp',
'modules/nt/prime_test.cpp',
'modules/nt/prime_gen.cpp',
'modules/nt/logarithms.cpp',
'modules/nt/factorization.cpp',
'modules/nt/rc4.cpp',
'modules/nt/cipher.cpp'],
extra_compile_args=['-std=c++20'],
swig_opts=['-c++'],
)
# BINARY DISTRIBUTION(with a Python wrapper)
class BinaryDistribution(dist.Distribution):
def has_ext_modules(modules):
return True
def main():
# main execution for building the dist
# pygpmp Python API modules
modules = [arithmetic, calculus, core, ml, linalg, nt]
# use the project readme as the description
with open('README.md', 'r', encoding='utf-8') as fh:
long_description = fh.read()
# def build_pkg():
setuptools.setup(
name='pygpmp',
distclass=BinaryDistribution,
# get version from PyPI package, use bump to increment
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
author='Akiel Aries',
author_email='[email protected]',
description='openGPMP Python API',
keywords='pygpmp, example, pypi, package',
long_description=long_description,
long_description_content_type='text/markdown',
url='https://github.com/akielaries/openGPMP',
project_urls={
'Documentation': 'https://akielaries.github.io/openGPMP/',
'Bug Reports':
'https://github.com/akielaries/openGPMP/issues',
'Source Code': 'https://github.com/akielaries/openGPMP/',
},
package_dir={'': '.'},
packages=['pygpmp',
'pygpmp.arithmetic',
'pygpmp.calculus',
'pygpmp.core',
'pygpmp.linalg',
'pygpmp.ml',
'pygpmp.nt',
],
ext_modules=modules,
include_package_data=True,
classifiers=[
# see https: //pypi.org/classifiers/
'Development Status :: 4 - Beta',
'Intended Audience :: Science/Research',
'Intended Audience :: Developers',
'Intended Audience :: Education',
'Intended Audience :: Information Technology',
'Topic :: Scientific/Engineering',
'Topic :: Scientific/Engineering :: Mathematics',
'Topic :: Scientific/Engineering :: Artificial Intelligence',
'Topic :: Software Development',
'Topic :: Software Development :: Build Tools',
'Topic :: Software Development :: Libraries',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Utilities',
'Topic :: Education',
'Topic :: Education :: Testing',
'Topic :: Documentation',
'Programming Language :: C++',
'Programming Language :: C',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Fortran',
'Programming Language :: R',
'Operating System :: POSIX',
'Operating System :: Unix',
'Operating System :: MacOS',
],
python_requires='>=3.6',
# install_requires = ['Pillow'],
extras_require={
'dev': ['check-manifest'],
# 'test' : ['coverage'],
},
)
if __name__ == '__main__':
main()