Skip to content

Commit 44f2a5c

Browse files
nirizrshiftre
authored andcommittedMar 28, 2017
Add setup specific tests (#242)
* Add setup specific tests Signed-off-by: Nir Izraeli <nirizr@gmail.com> * Fix setup.py flake issues Signed-off-by: Nir Izraeli <nirizr@gmail.com>
1 parent 50fd7b9 commit 44f2a5c

File tree

2 files changed

+21
-14
lines changed

2 files changed

+21
-14
lines changed
 

‎.travis.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ matrix:
1414
env: PROJECT=server DJANGO_SETTINGS_MODULE='rematch.settings.debug'
1515
- python: "3.5"
1616
env: PROJECT=server DJANGO_SETTINGS_MODULE='rematch.settings.production'
17+
- python: "2.7"
18+
env: PROJECT=setup.py
1719

1820
branches:
1921
only:
@@ -53,7 +55,6 @@ script:
5355
- flake8 ./${PROJECT} --show-source --statistics
5456
- if [ -d ./tests/${PROJECT} ]; then flake8 ./tests/${PROJECT} --show-source ; fi
5557
- if [ -d ./tests/${PROJECT} ]; then py.test ./${PROJECT} ./tests/${PROJECT} --verbose --cov-report= --cov=$PROJECT ; fi
56-
- ./setup.py ${PROJECT} sdist --formats=zip ; pip install ./dist/rematch-${PROJECT}-*.zip
5758

5859
after_success:
5960
- if [ -d ./tests/${PROJECT} ]; then coveralls ; fi

‎setup.py

+19-13
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44
import os
55
from setuptools import setup, find_packages
66

7+
78
# Utility function to read the README file.
89
# Used for the long_description. It's nice, because now 1) we have a top level
910
# README file and 2) it's easier to type in the README file than to put a raw
1011
# string in below ...
1112
def read(fname):
1213
return open(fname).read()
1314

15+
1416
def get_version(path):
1517
context = {}
1618
version_path = os.path.join(path, 'version.py')
@@ -22,12 +24,15 @@ def get_version(path):
2224

2325
return context['__version__']
2426

27+
2528
def get_requirements(fname):
2629
return open(fname).readlines()
2730

31+
2832
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+
3136

3237
def build_setup(name, package_name, version_path, package_base,
3338
package_data=None, script_args=None):
@@ -39,7 +44,7 @@ def build_setup(name, package_name, version_path, package_base,
3944
requirements_path = os.path.join(base_path, package_base, "requirements.txt")
4045
if os.path.exists(requirements_path):
4146
install_requires = get_requirements(requirements_path)
42-
if not package_base in package_data:
47+
if package_base not in package_data:
4348
package_data[package_base] = []
4449
package_data[package_base].append('requirements.txt')
4550
else:
@@ -55,15 +60,15 @@ def build_setup(name, package_name, version_path, package_base,
5560
readme_path = os.path.join(base_path, "README.rst")
5661
setup(
5762
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/",
6772
packages=find_packages_relative(package_base),
6873
package_data=package_data,
6974
extras_require=extras_require,
@@ -74,6 +79,7 @@ def build_setup(name, package_name, version_path, package_base,
7479
],
7580
)
7681

82+
7783
def build_setup_server(script_args=None):
7884
build_setup(name='server',
7985
package_name='rematch-server',
@@ -113,7 +119,7 @@ def build_setup_idaplugin(script_args=None):
113119
package = packages.pop() if len(packages) == 1 else sys.argv[1]
114120
if sys.argv[1] == package:
115121
sys.argv = sys.argv[:1] + sys.argv[2:]
116-
if package == 'server':
122+
if package == 'server':
117123
build_setup_server()
118124
elif package == 'idaplugin':
119125
build_setup_idaplugin()

0 commit comments

Comments
 (0)
Please sign in to comment.