Commit dc88181e by Eric Coissac

Add a --cobitools3 options to setup.py

parent 2f60e91d
......@@ -14,6 +14,58 @@ import os.path
from distutils import log
from distutils.extension import Extension
from distutils.dist import Distribution as ori_Distribution
class Distribution(ori_Distribution):
def __init__(self,attrs=None):
self.cobitools3=attrs['cobitools3']
ori_Distribution.__init__(self, attrs)
self.global_options.insert(0,('cobitools3', None, "intall location of the C library"
))
from distutils.command.build import build as build_ori
from distutils.core import Command
class build_clib(Command):
user_options=[]
def initialize_options(self):
self.clib_dir=self.distribution.cobitools3
def finalize_options(self):
if self.clib_dir is None:
self.clib_dir=get_python_lib()
def run(self):
log.info("Build the build/cobject directory")
try:
os.mkdir("build")
except OSError:
pass
try:
os.mkdir("build/cobject")
except OSError:
pass
oldwd = os.getcwd()
os.chdir("build/cobject")
install_clibdir_option="-DPYTHONLIB:STRING='%s'" % self.clib_dir
log.info("Run CMake")
subprocess.call(['cmake', install_clibdir_option, '../../src'])
log.info("Compile the shared C library")
subprocess.call(['make','install']) # temporary fix but should be in src
os.chdir(oldwd)
class build(build_ori):
def run(self):
self.run_command("build_clib")
build_ori.run(self)
sys.path.append(os.path.abspath("python"))
def findPackage(root,base=None):
......@@ -73,7 +125,7 @@ REQUIRES = ['Cython>=0.24',
os.environ['CFLAGS'] = '-O3 -Wall -I "src" -I "src/libecoPCR" -I "src/libjson"'
#install_dependencies(REQUIRES)
RunMake()
#RunMake()
from Cython.Build import cythonize
......@@ -133,6 +185,10 @@ setup(name=PACKAGE,
license=LICENSE,
url=URL,
ext_modules=xx,
distclass=Distribution,
cmdclass={'build': build,
'build_clib': build_clib},
cobitools3=get_python_lib(),
packages = findPackage('python'),
package_dir = {"" : "python"},
scripts = ['scripts/obi']
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment