Skip to content

Commit 8df48e8

Browse files
committed
Merge setup files into one with 1st command line argument specifying the package (#206)
Signed-off-by: Nir Izraeli <nirizr@gmail.com>
1 parent ff407c3 commit 8df48e8

File tree

4 files changed

+28
-26
lines changed

4 files changed

+28
-26
lines changed

setup/setup_base.py setup.py

+28-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#!/usr/bin/python
2+
3+
import sys
14
import os
25
from setuptools import setup, find_packages
36

@@ -32,7 +35,7 @@ def build_setup(name, package_name, version_path, package_base,
3235
package_data = {}
3336

3437
# generate install_requires based on requirements.txt
35-
base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "../"))
38+
base_path = os.path.abspath(os.path.dirname(__file__))
3639
requirements_path = os.path.join(base_path, package_base, "requirements.txt")
3740
if os.path.exists(requirements_path):
3841
install_requires = get_requirements(requirements_path)
@@ -70,3 +73,27 @@ def build_setup(name, package_name, version_path, package_base,
7073
],
7174
)
7275

76+
if __name__ == '__main__':
77+
packages = set(os.listdir('.')) & {'server', 'idaplugin'}
78+
79+
if len(sys.argv) < 2:
80+
print("Usage: {} {{package name}}".format(sys.argv[0]))
81+
print("Available packages are: {}".format(", ".join(packages)))
82+
sys.exit(1)
83+
84+
package = packages.pop() if len(packages) == 1 else sys.argv[1]
85+
86+
if sys.argv[1] == package:
87+
sys.argv = sys.argv[:1] + sys.argv[2:]
88+
if package == 'server':
89+
build_setup(name='server',
90+
package_name='rematch-server',
91+
version_path='./',
92+
package_base='server')
93+
elif package == 'idaplugin':
94+
package_data = {'idaplugin/rematch': ['images/*']}
95+
build_setup(name='idaplugin',
96+
package_name='rematch-idaplugin',
97+
version_path='rematch',
98+
package_base='idaplugin',
99+
package_data=package_data)

setup/release.sh

-7
This file was deleted.

setup/setup_idaplugin.py

-10
This file was deleted.

setup/setup_server.py

-8
This file was deleted.

0 commit comments

Comments
 (0)