-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
79 lines (62 loc) · 2.32 KB
/
Copy pathsetup.py
File metadata and controls
79 lines (62 loc) · 2.32 KB
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
import os
import sys
import shutil
from os.path import join
import distutils.command.build as _build
from distutils import spawn
from setuptools import setup
current_path = os.path.dirname(os.path.abspath(__file__))
def extend_build(package_name):
class build(_build.build):
# This building process is for win/mac/android only.
# iOS will build by the kivy recept.
def build_cryptopp(self):
cryptopp_path = join(current_path, "cryptopp")
os.chdir(cryptopp_path)
try:
spawn.spawn((["make", "clean"]))
spawn.spawn((["make", "static", "-j8"]))
except spawn.DistutilsExecError:
sys.stderr.write("Error while building cryptopp\n")
sys.exit(-1)
def build_aes_cfb(self):
aes_cfb = join(current_path, "aes_cfb")
print(os.environ)
os.chdir(aes_cfb)
try:
# cmake -Bbuild
spawn.spawn((["cmake", "-Bbuild"]))
# cmake --build build -v -j8 --config Release --target aes_cfb
spawn.spawn(['cmake', "--build", "build", "--config", "Release", "--target", "aes_cfb"])
os.chdir(current_path)
except spawn.DistutilsExecError:
sys.stderr.write("Error while building aes_cfb\n")
sys.exit(-1)
def run(self):
_source_dir = current_path
# Clean build folder, because the setup will not rebuild so when any code in aes_cfb changed.
build_dir = join(current_path, "build")
if os.path.isdir(build_dir):
shutil.rmtree(build_dir)
self.build_cryptopp()
self.build_aes_cfb()
os.chdir(current_path)
_build.build.run(self)
return build
setup(
name='pyAES_CFB',
version='1.0',
author='XX-Net-Dev',
description='A python bundle for AES CFB',
long_description='A python bundle for AES CFB',
url='https://github.com/XX-Net/pyAES',
keywords='development, setup, setuptools',
python_requires='>=3.8, <4',
packages=[
"cryptopp",
],
setup_requires=["cffi>=1.0.0"],
cffi_modules=['build_pyAES.py:ffibuilder'],
install_requires=["cffi>=1.0.0"],
cmdclass={'build': extend_build('aes_cfb')},
)