|
| 1 | +#!/usr/bin/python |
| 2 | + |
| 3 | +import sys |
1 | 4 | import os
|
2 | 5 | from setuptools import setup, find_packages
|
3 | 6 |
|
@@ -32,7 +35,7 @@ def build_setup(name, package_name, version_path, package_base,
|
32 | 35 | package_data = {}
|
33 | 36 |
|
34 | 37 | # 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__)) |
36 | 39 | requirements_path = os.path.join(base_path, package_base, "requirements.txt")
|
37 | 40 | if os.path.exists(requirements_path):
|
38 | 41 | install_requires = get_requirements(requirements_path)
|
@@ -70,3 +73,27 @@ def build_setup(name, package_name, version_path, package_base,
|
70 | 73 | ],
|
71 | 74 | )
|
72 | 75 |
|
| 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) |
0 commit comments