4
4
import os
5
5
from setuptools import setup , find_packages
6
6
7
+
7
8
# Utility function to read the README file.
8
9
# Used for the long_description. It's nice, because now 1) we have a top level
9
10
# README file and 2) it's easier to type in the README file than to put a raw
10
11
# string in below ...
11
12
def read (fname ):
12
13
return open (fname ).read ()
13
14
15
+
14
16
def get_version (path ):
15
17
context = {}
16
18
version_path = os .path .join (path , 'version.py' )
@@ -22,12 +24,15 @@ def get_version(path):
22
24
23
25
return context ['__version__' ]
24
26
27
+
25
28
def get_requirements (fname ):
26
29
return open (fname ).readlines ()
27
30
31
+
28
32
def find_packages_relative (base ):
29
- return [base ] + [os .path .join (base , package )
30
- for package in find_packages (base )]
33
+ return ([os .path .join (base , package ) for package in find_packages (base )] +
34
+ [base ])
35
+
31
36
32
37
def build_setup (name , package_name , version_path , package_base ,
33
38
package_data = None , script_args = None ):
@@ -39,7 +44,7 @@ def build_setup(name, package_name, version_path, package_base,
39
44
requirements_path = os .path .join (base_path , package_base , "requirements.txt" )
40
45
if os .path .exists (requirements_path ):
41
46
install_requires = get_requirements (requirements_path )
42
- if not package_base in package_data :
47
+ if package_base not in package_data :
43
48
package_data [package_base ] = []
44
49
package_data [package_base ].append ('requirements.txt' )
45
50
else :
@@ -55,15 +60,15 @@ def build_setup(name, package_name, version_path, package_base,
55
60
readme_path = os .path .join (base_path , "README.rst" )
56
61
setup (
57
62
script_args = script_args ,
58
- name = package_name ,
59
- version = get_version (version_path ),
60
- author = "Nir Izraeli" ,
61
- author_email = "nirizr@gmail.com" ,
62
- description = ("A IDA Pro plugin and server framework for binary function "
63
- "level diffing." ),
64
- keywords = ["rematch" , "ida" , "idapro" , "bindiff" , "binary diffing" ,
65
- "reverse engineering" ],
66
- url = "https://www.github.com/nirizr/rematch/" ,
63
+ name = package_name ,
64
+ version = get_version (version_path ),
65
+ author = "Nir Izraeli" ,
66
+ author_email = "nirizr@gmail.com" ,
67
+ description = ("A IDA Pro plugin and server framework for binary function "
68
+ "level diffing." ),
69
+ keywords = ["rematch" , "ida" , "idapro" , "bindiff" , "binary diffing" ,
70
+ "reverse engineering" ],
71
+ url = "https://www.github.com/nirizr/rematch/" ,
67
72
packages = find_packages_relative (package_base ),
68
73
package_data = package_data ,
69
74
extras_require = extras_require ,
@@ -74,6 +79,7 @@ def build_setup(name, package_name, version_path, package_base,
74
79
],
75
80
)
76
81
82
+
77
83
def build_setup_server (script_args = None ):
78
84
build_setup (name = 'server' ,
79
85
package_name = 'rematch-server' ,
@@ -113,7 +119,7 @@ def build_setup_idaplugin(script_args=None):
113
119
package = packages .pop () if len (packages ) == 1 else sys .argv [1 ]
114
120
if sys .argv [1 ] == package :
115
121
sys .argv = sys .argv [:1 ] + sys .argv [2 :]
116
- if package == 'server' :
122
+ if package == 'server' :
117
123
build_setup_server ()
118
124
elif package == 'idaplugin' :
119
125
build_setup_idaplugin ()
0 commit comments