-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsetup.py
46 lines (41 loc) · 1.4 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
from setuptools import setup, find_packages
from setuptools.command.install import install
import subprocess
import os
import sys
import shutil
import multiprocessing
if sys.platform == 'darwin':
libName = 'libropchain.dylib'
elif sys.platform in ('win32', 'cygwin'):
libName = 'libropchain.dll'
else:
libName = 'libropchain.so'
class CustomInstallCommand(install):
def buildFFI(self):
os.chdir('ropchain/ffi')
libPath = 'build/src/python_module/%s' % libName
cores = multiprocessing.cpu_count()
cmd1 = ['pwd']
cmd2 = ['./waf', 'configure', 'build', '-j%d' % (2 * cores), '--rp', '--mod']
for cmd in (cmd1, cmd2):
subprocess.Popen(cmd).wait()
os.chdir('../..')
shutil.move('ropchain/ffi/%s' % libPath, 'ropchain/%s' % libName)
shutil.rmtree('ropchain/ffi/')
def run(self):
self.buildFFI()
install.run(self)
setup(
name = 'ropchain',
version = '0.1.9.4',
description = 'ROPChain generator',
license = 'GPL3.0',
author = 'kriw',
author_email = 'kotarou777775@gmail.com',
url = 'https://github.com/kriw/ropchain',
keywords = '',
packages = find_packages(),
cmdclass = {'install': CustomInstallCommand},
include_package_data = True
)