-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsetup.py
129 lines (107 loc) · 4.18 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
# bumpversion patch
# python setup.py register sdist upload
# from distutils.core import setup
from setuptools import setup, find_packages
import sys
import os
import os.path as op
import distutils.spawn as ds
import distutils.dir_util as dd
from setuptools.command.install import install
import platform
## This file is not used now. TODO finish setup.py install process
#################
# CMake function
#################
#def run_cmake(cmake_args="-DSIMX_USE_PRIME=1 -DSIMX_USE_MPI=1"):
cmake_pkgdir = '${CMAKE_CURRENT_SOURCE_DIR}'
if cmake_pkgdir[0] == '$':
print("CMAKE_CURRENT_SOURCE_DIR is not set")
package_dir={}# {'':'./'}
else:
# package_dir={ '': cmake_pkgdir }
package_dir={}
__VERSION__='1.8.6'
# src_dir = os.path.abspath(__file__)
# src_dir, fl = os.path.split(src_dir)
# src_dir = src_dir + "/src"
def run_cmake(no_setuppy=1):
"""
Runs CMake to determine configuration for this build
"""
if ds.find_executable('cmake') is None:
print("CMake is required to build skelet3d .so lib")
print( "Please install cmake version >= 2.6 and re-run setup")
sys.exit(-1)
print("Configuring skelet3d build with CMake.... ")
new_dir = op.join(op.split(__file__)[0],'build')
dd.mkpath(new_dir)
os.chdir(new_dir)
# construct argument string
cmake_args = ''
# cmake_args ="-DNO_SETUPPY=" + str(no_setuppy)
try:
ds.spawn(['cmake','../']+cmake_args.split())
except ds.DistutilsExecError:
print("Error while running cmake")
print("run 'setup.py build --help' for build options")
print("You may also try editing the settings in CMakeLists.txt file and re-running setup")
sys.exit(-1)
try:
ds.spawn(['cmake', "--build", "."]) # +cmake_args.split())
except ds.DistutilsExecError:
print("Error while: cmake --build .")
print("run 'setup.py build --help' for build options")
print("You may also try editing the settings in CMakeLists.txt file and re-running setup")
sys.exit(-1)
try:
ds.spawn(['cmake', "--install", "."]) # +cmake_args.split())
except ds.DistutilsExecError:
print("Error while: cmake --build .")
print("run 'setup.py build --help' for build options")
print("You may also try editing the settings in CMakeLists.txt file and re-running setup")
sys.exit(-1)
class CustomInstallCommand(install):
"""Customized setuptools install command - prints a friendly greeting."""
def run(self):
print("Performing Custom Install Command ...")
# if platform.system() == "Linux":
# run_cmake()
install.run(self)
print("install.run() finished...")
# run_cmake()
print('pkgdir = ', package_dir)
setup(
name='skelet3d',
version=__VERSION__,
package_dir=package_dir,
author='Miroslav Jirik',
author_email="miroslav.jirik@gmail.com",
url='https://github.com/mjirik/skelet3d',
# "c:\\users/mjirik/projects/skelet3d/src" },
packages=find_packages(),
cmdclass={
'install': CustomInstallCommand,
},
# py_modules=['skelet3d']
install_requires=['numpy', 'scipy'], #, 'wget'],
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
license='MIT',
classifiers=[
# How mature is this project? Common values are
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
'Development Status :: 3 - Alpha',
# Indicate who your project is intended for
'Intended Audience :: Developers',
'Topic :: Scientific/Engineering :: Bio-Informatics',
# Pick your license as you wish (should match "license" above)
'License :: OSI Approved :: BSD License',
# Specify the Python versions you support here. In particular, ensure
# that you indicate whether you support Python 2, Python 3 or both.
# 'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.6',
],
)