Skip to content

Commit

Permalink
[CI] Update setup.py for including GEDLIB for dist and wheel.
Browse files Browse the repository at this point in the history
  • Loading branch information
jajupmochi committed Feb 8, 2024
1 parent 35b63a6 commit 251947f
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 19 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ A Python package for graph kernels, graph edit distances and graph pre-image pro
* tqdm>=4.26.0
* control>=0.8.2 (for generalized random walk kernels only)
* 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`))
* Cython~=0.29.33 (for GEDLIB only)

## How to use?

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ tabulate>=0.8.2
tqdm>=4.26.0
control>=0.8.2 # for generalized random walk kernels only.
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`)
Cython>=0.29.33 # for GEDLIB.
Cython~=0.29.33 # for GEDLIB.
cvxpy>=1.0.31 # for preimage. Does not work for "pip install graphkit-learn".
# -e https://files.pythonhosted.org/packages/11/d0/d900870dc2d02ea74961b90c353666c6528a33ea61a10aa59a0d5574ae59/cvxpy-1.0.31.tar.gz # for preimage.
cvxopt>=1.2.5 # for preimage.
Expand Down
2 changes: 1 addition & 1 deletion requirements_pypi.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ tabulate>=0.8.2
tqdm>=4.26.0
control>=0.8.2 # for generalized random walk kernels only.
# 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`)
Cython>=0.29.33 # for GEDLIB.
Cython~=0.29.33 # for GEDLIB.
# cvxpy>=1.0.31 # for preimage. Does not work for "pip install graphkit-learn".
# -e https://files.pythonhosted.org/packages/11/d0/d900870dc2d02ea74961b90c353666c6528a33ea61a10aa59a0d5574ae59/cvxpy-1.0.31.tar.gz # for preimage.
cvxopt>=1.2.5 # for preimage.
Expand Down
66 changes: 49 additions & 17 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,52 @@ def parse_args():

args = parse_args()

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
)
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:
Expand Down Expand Up @@ -109,6 +138,9 @@ def parse_args():
'Intended Audience :: Developers',
],
install_requires=install_requires,
cmdclass={
'install': CustomInstallCommand,
},
# package_dir={'': 'gklearn'},
# package_data={
# # '': ['README.md', 'requirements_pypi.txt', 'requirements.txt', 'LICENSE'],
Expand Down

0 comments on commit 251947f

Please sign in to comment.