Skip to content

Commit 251947f

Browse files
committed
[CI] Update setup.py for including GEDLIB for dist and wheel.
1 parent 35b63a6 commit 251947f

File tree

4 files changed

+52
-19
lines changed

4 files changed

+52
-19
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ A Python package for graph kernels, graph edit distances and graph pre-image pro
2121
* tqdm>=4.26.0
2222
* control>=0.8.2 (for generalized random walk kernels only)
2323
* slycot>=0.3.3 (for generalized random walk kernels only, which requires a fortran compiler (e.g., `gfortran`) and BLAS/LAPACK (e.g. `liblapack-dev`))
24+
* Cython~=0.29.33 (for GEDLIB only)
2425

2526
## How to use?
2627

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ tabulate>=0.8.2
77
tqdm>=4.26.0
88
control>=0.8.2 # for generalized random walk kernels only.
99
slycot>=0.3.3 # for generalized random walk kernels only, which requires a fortran compiler (e.g., `gfortran`) and BLAS/LAPACK (e.g. `liblapack-dev`)
10-
Cython>=0.29.33 # for GEDLIB.
10+
Cython~=0.29.33 # for GEDLIB.
1111
cvxpy>=1.0.31 # for preimage. Does not work for "pip install graphkit-learn".
1212
# -e https://files.pythonhosted.org/packages/11/d0/d900870dc2d02ea74961b90c353666c6528a33ea61a10aa59a0d5574ae59/cvxpy-1.0.31.tar.gz # for preimage.
1313
cvxopt>=1.2.5 # for preimage.

requirements_pypi.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ tabulate>=0.8.2
77
tqdm>=4.26.0
88
control>=0.8.2 # for generalized random walk kernels only.
99
# slycot>=0.3.3 # for generalized random walk kernels only, which requires a fortran compiler (e.g., `gfortran`) and BLAS/LAPACK (e.g. `liblapack-dev`)
10-
Cython>=0.29.33 # for GEDLIB.
10+
Cython~=0.29.33 # for GEDLIB.
1111
# cvxpy>=1.0.31 # for preimage. Does not work for "pip install graphkit-learn".
1212
# -e https://files.pythonhosted.org/packages/11/d0/d900870dc2d02ea74961b90c353666c6528a33ea61a10aa59a0d5574ae59/cvxpy-1.0.31.tar.gz # for preimage.
1313
cvxopt>=1.2.5 # for preimage.

setup.py

Lines changed: 49 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -60,23 +60,52 @@ def parse_args():
6060

6161
args = parse_args()
6262

63-
if args.build_gedlibpy == 'true':
64-
# Compile GEDLIBPY module:
65-
import subprocess
66-
67-
cur_python = sys.executable
68-
subprocess.call([cur_python, '--version'])
69-
subprocess.call(['which', cur_python])
70-
gedlib_dir = 'gklearn/gedlib/'
71-
subprocess.call(
72-
[
73-
cur_python, 'setup_simple.py', # 'setup.py',
74-
# '--use-existing-gedlib', args.use_existing_gedlib,
75-
# '--build-gedlib', args.build_gedlib,
76-
# '--develop-mode', args.develop_mode,
77-
'build_ext', '--inplace'
78-
], cwd=gedlib_dir
79-
)
63+
from setuptools.command.install import install
64+
65+
66+
class CustomInstallCommand(install):
67+
"""Customized setuptools install command - prints a friendly greeting."""
68+
69+
70+
def run(self):
71+
if args.build_gedlibpy == 'true':
72+
# Compile GEDLIBPY module:
73+
import subprocess
74+
75+
cur_python = sys.executable
76+
subprocess.call([cur_python, '--version'])
77+
subprocess.call(['which', cur_python])
78+
gedlib_dir = 'gklearn/gedlib/'
79+
subprocess.call(
80+
[
81+
cur_python, 'setup_simple.py', # 'setup.py',
82+
# '--use-existing-gedlib', args.use_existing_gedlib,
83+
# '--build-gedlib', args.build_gedlib,
84+
# '--develop-mode', args.develop_mode,
85+
'build_ext', '--inplace'
86+
], cwd=gedlib_dir
87+
)
88+
89+
install.run(self)
90+
91+
92+
# if args.build_gedlibpy == 'true':
93+
# # Compile GEDLIBPY module:
94+
# import subprocess
95+
#
96+
# cur_python = sys.executable
97+
# subprocess.call([cur_python, '--version'])
98+
# subprocess.call(['which', cur_python])
99+
# gedlib_dir = 'gklearn/gedlib/'
100+
# subprocess.call(
101+
# [
102+
# cur_python, 'setup_simple.py', # 'setup.py',
103+
# # '--use-existing-gedlib', args.use_existing_gedlib,
104+
# # '--build-gedlib', args.build_gedlib,
105+
# # '--develop-mode', args.develop_mode,
106+
# 'build_ext', '--inplace'
107+
# ], cwd=gedlib_dir
108+
# )
80109

81110
# Install graphkit-learn:
82111
with open("README.md", "r") as fh:
@@ -109,6 +138,9 @@ def parse_args():
109138
'Intended Audience :: Developers',
110139
],
111140
install_requires=install_requires,
141+
cmdclass={
142+
'install': CustomInstallCommand,
143+
},
112144
# package_dir={'': 'gklearn'},
113145
# package_data={
114146
# # '': ['README.md', 'requirements_pypi.txt', 'requirements.txt', 'LICENSE'],

0 commit comments

Comments
 (0)