-
Notifications
You must be signed in to change notification settings - Fork 19
/
setup.py
149 lines (128 loc) · 4.25 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
import sys
import setuptools
from datetime import datetime
def parse_args():
import argparse
parser = argparse.ArgumentParser()
parser.add_argument(
'--build-gedlibpy',
dest='build_gedlibpy',
type=str,
choices=['true', 'false'],
default='true',
help='Whether to build the Cython gedlibpy module. If `false`, then it '
'is possible that the module would not work when it is incompatible'
' with the system (libraries).'
)
parser.add_argument(
'--use-existing-gedlib',
dest='use_existing_gedlib',
type=str,
choices=['true', 'false'],
default='false',
help='Whether to use an existing GEDLIB C++ library. This will avoid '
'downloading the library from GitHub and extracting it. If no library '
'is found, the installation will stop and an error will be raised. '
'Does not have effect when `--build-gedlibpy` is set to `false`. It may help '
'when you have problem accessing GitHub or it takes too long time to '
'extract the file (which is my case on CentOS (I hate this system!)). '
)
parser.add_argument(
'--build-gedlib',
dest='build_gedlib',
type=str,
choices=['true', 'false'],
default='true',
help='Whether to build GEDLIB C++. Does not have effect when '
'`--build-gedlibpy` is set to `false`.'
)
parser.add_argument(
'--develop-mode',
dest='develop_mode',
type=str,
choices=['true', 'false'],
default='true',
help='Whether in development mode. If true, the include files in the '
'`gedlibpy` module will be deleted after installation. Does not '
'have effect when `--build-gedlibpy` is set to `false`. Notice, the '
'default value is `true`.'
)
args, unknown = parser.parse_known_args()
return args
args = parse_args()
from setuptools.command.install import install
class CustomInstallCommand(install):
"""Customized setuptools install command - prints a friendly greeting."""
def run(self):
if args.build_gedlibpy == 'true':
# Compile GEDLIBPY module:
import subprocess
cur_python = sys.executable
subprocess.call([cur_python, '--version'])
subprocess.call(['which', cur_python])
gedlib_dir = 'gklearn/gedlib/'
subprocess.call(
[
cur_python, 'setup_simple.py', # 'setup.py',
# '--use-existing-gedlib', args.use_existing_gedlib,
# '--build-gedlib', args.build_gedlib,
# '--develop-mode', args.develop_mode,
'build_ext', '--inplace'
], cwd=gedlib_dir
)
install.run(self)
# if args.build_gedlibpy == 'true':
# # Compile GEDLIBPY module:
# import subprocess
#
# cur_python = sys.executable
# subprocess.call([cur_python, '--version'])
# subprocess.call(['which', cur_python])
# gedlib_dir = 'gklearn/gedlib/'
# subprocess.call(
# [
# cur_python, 'setup_simple.py', # 'setup.py',
# # '--use-existing-gedlib', args.use_existing_gedlib,
# # '--build-gedlib', args.build_gedlib,
# # '--develop-mode', args.develop_mode,
# 'build_ext', '--inplace'
# ], cwd=gedlib_dir
# )
# Install graphkit-learn:
with open("README.md", "r") as fh:
long_description = fh.read()
with open('requirements_pypi.txt') as fp:
install_requires = fp.read()
version = '0.2.1.post' + datetime.now().strftime('%Y%m%d%H%M%S')
setuptools.setup(
name="graphkit-learn",
version=version,
author="Linlin Jia",
author_email="jajupmochi@gmail.com",
description="A Python library for machine learning on graphs.",
long_description=long_description,
long_description_content_type="text/markdown",
project_urls={
'Documentation': 'https://graphkit-learn.readthedocs.io',
'Source': 'https://github.com/jajupmochi/graphkit-learn',
'Tracker': 'https://github.com/jajupmochi/graphkit-learn/issues',
},
url="https://github.com/jajupmochi/graphkit-learn",
packages=setuptools.find_packages(),
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: OS Independent",
'Intended Audience :: Science/Research',
'Intended Audience :: Developers',
],
install_requires=install_requires,
cmdclass={
'install': CustomInstallCommand,
},
# package_dir={'': 'gklearn'},
# package_data={
# # '': ['README.md', 'requirements_pypi.txt', 'requirements.txt', 'LICENSE'],
# 'gedlib': ['README.rst', 'gedlibpy.pyx', '*.hpp', '*.ipp'],
# },
)