-
Notifications
You must be signed in to change notification settings - Fork 58
/
setup.py
68 lines (58 loc) · 1.97 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
from distutils.core import setup
from setuptools import find_packages # type: ignore
from setuptools.command.build_py import build_py
from kgtk import __version__
import sys
lite_build = False
if '--lite' in sys.argv:
lite_build = True
sys.argv.remove('--lite')
with open('requirements.txt', 'r') as f:
install_requires = list()
dependency_links = list()
for line in f:
re = line.strip()
if re:
if re.startswith('git+') or re.startswith('svn+') or re.startswith('hg+'):
dependency_links.append(re)
else:
install_requires.append(re)
if not lite_build:
with open('requirements-full.txt', 'r') as f:
for line in f:
re = line.strip()
if re:
if re.startswith('git+') or re.startswith('svn+') or re.startswith('hg+'):
dependency_links.append(re)
else:
install_requires.append(re)
lite_excluded_modules = {
'kgtk.cli': {'filter', 'export_gt', 'export_neo4j', 'connected-components', 'graph_statistics', 'gt_loader',
'reachable_nodes', 'text_embedding'}
}
class kgtk_build_py(build_py):
def find_package_modules(self, package, package_dir):
modules = super().find_package_modules(package, package_dir)
if lite_build and package in lite_excluded_modules:
modules = list(filter(lambda m: m[1] not in lite_excluded_modules[package], modules))
return modules
packages = find_packages()
setup(
name='kgtk' if not lite_build else 'kgtk-lite',
version=__version__,
packages=packages,
url='https://github.com/usc-isi-i2/kgtk',
license='MIT',
author='ISI CKGs',
include_package_data=True,
install_requires=install_requires,
dependency_links=dependency_links,
entry_points={
'console_scripts': [
'kgtk = kgtk.cli_entry:cli_entry',
],
},
cmdclass={
'build_py': kgtk_build_py
}
)