Commit 10ab5572 by Eric Coissac

First version of the simplified setup.py script

parent 06178d9d
ifeq ($(CC),gcc)
LFLAGS = -fopenmp
else
LFLAGS =
endif
SOURCE_DIR := src
ENV_DIR := $(abspath .)
OBJ_DIR := $(ENV_DIR)/obi_objdir
LIB_DIR := $(ENV_DIR)/obi_libdir
SOURCE_FILES = $(SOURCE_DIR)/libecoPCR/libapat/*.c $(SOURCE_DIR)/libecoPCR/libthermo/*.c $(SOURCE_DIR)/libecoPCR/*.c $(SOURCE_DIR)/libjson/*.c $(SOURCE_DIR)/*.c
OBJ_FILES = $(OBJ_DIR)/*.o
DYN_LIB_FILES = $(LIB_DIR)/libobi3.so
all: $(DYN_LIB_FILES)
$(LIB_DIR):
mkdir -p $(LIB_DIR)
$(OBJ_DIR):
mkdir -p $(OBJ_DIR)
$(DYN_LIB_FILES): $(OBJ_FILES) | $(LIB_DIR)
$(CC) -shared -o $@ $^
$(OBJ_FILES): | $(OBJ_DIR)
$(CC) $(LFLAGS) -fpic -c $(SOURCE_FILES)
mv *.o $(OBJ_DIR)
clean:
rm -rf $(LIB_DIR)
rm -rf $(OBJ_DIR)
......@@ -6,5 +6,3 @@ Created on 28 juillet 2017
@author: coissac
'''
from obitools3.dms.dms cimport DMS
from obitools3.utils cimport tobytes,tostr
\ No newline at end of file
......@@ -17,6 +17,9 @@ from obitools3.dms.dms import DMS
from obitools3.apps.config import getConfiguration
from obitools3.apps.config import logger
from obitools3.dms.dms cimport DMS
from obitools3.utils cimport tobytes,tostr
cpdef get_temp_dir():
"""
Returns a temporary directory object specific of this instance of obitools.
......
#cython: language_level=3
from obitools3.dms.capi.obitypes cimport index_t, \
name_data_type, \
obitype_t, \
obiversion_t, \
OBI_QUAL
from ..capi.obitypes cimport index_t, \
obitype_t
from obitools3.dms.capi.obidmscolumn cimport OBIDMS_column_header_p, \
obi_close_column, \
obi_get_elements_names, \
obi_column_write_comments
from ..capi.obidmscolumn cimport OBIDMS_column_p
from obitools3.dms.capi.obidmscolumn cimport OBIDMS_column_p
from ..view.view cimport View
from obitools3.dms.view.view cimport View
from ..object cimport OBIWrapper
from obitools3.dms.object cimport OBIWrapper
cdef dict __OBIDMS_COLUMN_CLASS__
......
......@@ -3,27 +3,31 @@
__OBIDMS_COLUMN_CLASS__ = {}
from ..capi.obitypes cimport name_data_type, \
obitype_t, \
obiversion_t, \
OBI_QUAL
from ..capi.obidms cimport obi_import_column
from ..capi.obidmscolumn cimport OBIDMS_column_header_p, \
from obitools3.dms.object cimport OBIWrapper
from obitools3.dms.capi.obidmscolumn cimport OBIDMS_column_p
from obitools3.dms.capi.obitypes cimport index_t, \
name_data_type, \
obitype_t, \
obiversion_t, \
OBI_QUAL
from obitools3.dms.capi.obidmscolumn cimport OBIDMS_column_header_p, \
obi_close_column, \
obi_get_elements_names, \
obi_column_write_comments
from obitools3.dms.capi.obidms cimport obi_import_column
from obitools3.dms.view.view cimport View
from ..capi.obiutils cimport obi_format_date
from obitools3.dms.capi.obiutils cimport obi_format_date
from ..capi.obiview cimport obi_view_add_column, \
from obitools3.dms.capi.obiview cimport obi_view_add_column, \
obi_view_get_pointer_on_column_in_view, \
Obiview_p, \
NUC_SEQUENCE_COLUMN
from ..object cimport OBIDeactivatedInstanceError
from obitools3.dms.object cimport OBIDeactivatedInstanceError
from obitools3.utils cimport tobytes, \
bytes2str, \
......
# #cython: language_level=3
from ..capi.obitypes cimport index_t
from .column cimport Column, \
Column_multi_elts
from obitools3.dms.capi.obitypes cimport index_t
cdef class Column_idx(Column) :
......
......@@ -2,23 +2,26 @@
from obitools3.dms.capi.obierrno cimport obi_errno
from ..view.view cimport View
from obitools3.dms.view.view cimport View
from obitools3.utils cimport tobytes, \
obi_errno_to_exception
from ..capi.obiview cimport obi_get_index_with_elt_name_and_col_p_in_view, \
from obitools3.dms.capi.obiview cimport obi_get_index_with_elt_name_and_col_p_in_view, \
obi_get_index_with_elt_idx_and_col_p_in_view, \
obi_set_index_with_elt_name_and_col_p_in_view, \
obi_set_index_with_elt_idx_and_col_p_in_view, \
Obiview_p
from ..capi.obidmscolumn cimport OBIDMS_column_p
from obitools3.dms.capi.obidmscolumn cimport OBIDMS_column_p
from ..capi.obitypes cimport OBI_IDX, OBIIdx_NA, index_t
from obitools3.dms.capi.obitypes cimport OBI_IDX, OBIIdx_NA, index_t
from cpython.long cimport PyLong_FromLongLong
from obitools3.dms.column.column cimport Column, \
Column_multi_elts
# TODO overwrite other functions from Column and Column_multi_elts
......
#cython: language_level=3
# cython: language_level=3
from obitools3.dms.capi.obitypes cimport obitype_t, index_t
......
#cython: language_level=3
# cython: language_level=3
# distutils: include_dirs = src
from obitools3.dms.capi.obitypes cimport is_a_DNA_seq, \
OBI_VOID, \
......
#!/usr/bin/env python
import glob
import os
import sys
import re
import subprocess
from distutils.core import setup,Extension
from distutils.sysconfig import get_python_lib
from Cython.Build import cythonize
import os.path
from distutils import log
from distutils.extension import Extension
sys.path.append(os.path.abspath("python"))
print(sys.path)
def findPackage(root,base=None):
modules=[]
if base is None:
base=[]
for module in (os.path.basename(os.path.dirname(x))
for x in glob.glob(os.path.join(root,'*','__init__.py'))):
modules.append('.'.join(base+[module]))
modules.extend(findPackage(os.path.join(root,module),base+[module]))
return modules
PACKAGE = "OBITools3"
VERSION = "0.0.0"
AUTHOR = 'Eric Coissac'
EMAIL = 'eric@coissac.eu'
URL = 'metabarcoding.org/obitools3'
LICENSE = 'CeCILL-V2'
DESCRIPTION ="Scripts and library for DNA metabarcoding",
EMAIL = 'eric@metabarcoding.org'
URL = "metabarcoding.org/obitools3"
LICENSE = "CeCILL-V2"
DESCRIPTION = "Tools and library for DNA metabarcoding",
PYTHONMIN = '3.6'
SRC = 'python'
CSRC = 'src'
REQUIRES = ['Cython>=0.24',
'Sphinx>=1.2.0',
'ipython>=3.0.0',
'breathe>=4.0.0'
]
os.environ['CFLAGS'] = '-O3 -Wall -I "src" -I "src/libecoPCR" -I "src/libjson"'
#sys.path.append("/Users/coissac/git/obitools3/python")
cython_src = [x for x in glob.iglob('python/obitools3/**/*.pyx',
recursive=True
)
]
#with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as f:
# readme = f.read()
install_clibdir_option="-DPYTHONLIB:STRING='%s'" % get_python_lib()
subprocess.call(['cmake', install_clibdir_option, 'src'])
subprocess.call(['make', '-C', 'src','install'])
cython_ext = [Extension('.'.join(["obitools3",
os.path.basename(os.path.dirname(x)),
os.path.splitext(os.path.basename(x))[0]]),
[x],
library_dirs=[get_python_lib()],
include_dirs=["src","src/libecoPCR","src/libjson"],
libraries=["cobitools3"],
runtime_library_dirs=[get_python_lib()],
extra_compile_args=['-msse2',
'-Wno-unused-function',
'-Wmissing-braces',
'-Wchar-subscripts',
'-fPIC'
],
extra_link_args=["-Wl,-rpath,"+get_python_lib(),
"-L"+get_python_lib()
]
)
for x in cython_src
]
xx = cythonize(cython_ext,
language_level=3,
annotate=True)
#, include_path=["src","src/libecoPCR","src/libjson"]
classifiers=['Development Status :: 1 - Planning',
'Environment :: Console',
'Intended Audience :: Science/Research',
'License :: Other/Proprietary License',
'Operating System :: Unix',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: C',
'Topic :: Scientific/Engineering :: Bio-Informatics',
'Topic :: Utilities',
]
PYTHONMIN='3.4'
sys.path.append('distutils.ext')
sys.path.append(SRC)
if __name__=="__main__":
import sys
print("----------------")
print(" ".join(sys.argv))
print("----------------")
#
# Horrible hack
#
if sys.argv[0]=="-c":
sys.argv[0]="setup.py"
#
# End of the horrible hack
#
try:
from obitools3 import version
VERSION = version.version
except ImportError:
pass
from obidistutils.serenity import serenity_mode
serenity=serenity_mode(PACKAGE,VERSION)
from obidistutils.core import setup
from obidistutils.core import CTOOLS
from obidistutils.core import CEXES
from obidistutils.core import FILES
# Produce annotated html files
import Cython.Compiler.Options
Cython.Compiler.Options.annotate = True
setup(name=PACKAGE,
description=DESCRIPTION,
classifiers=classifiers,
version=VERSION,
author=AUTHOR,
author_email=EMAIL,
license=LICENSE,
url=URL,
python_src=SRC,
sse='sse2',
serenity=serenity,
pythonmin=PYTHONMIN)
setup(name=PACKAGE,
description=DESCRIPTION,
classifiers=classifiers,
version=VERSION,
author=AUTHOR,
author_email=EMAIL,
license=LICENSE,
url=URL,
ext_modules=xx,
packages = findPackage('python'),
package_dir = {"" : "python"},
scripts = ['python/obi.py']
)
cmake_minimum_required(VERSION 3.12)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
project (cobitools3)
set(CMAKE_BUILD_TYPE Release)
SET(CMAKE_C_COMPILER gcc)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
file(GLOB_RECURSE CSRC "*.c")
add_library(cobitools3 SHARED obierrno.c
obidms_taxonomy.c
obiblob_indexer.c
obi_lcs.c
obidmscolumn_str.c
bloom.c
build_reference_db.c
obidmscolumn_array.c
obidmscolumn_idx.c
obidmscolumn_bool.c
libjson/json_utils.c
libjson/cJSON.c
obidmscolumn_blob.c
dna_seq_indexer.c
obi_ecotag.c
encode.c
obiavl.c
sse_banded_LCS_alignment.c
kmer_similarity.c
obidmscolumn_qual.c
obi_clean.c
utils.c
uint8_indexer.c
murmurhash2.c
obidmscolumn_char.c
obiview.c
obidmscolumn_int.c
linked_list.c
obiblob.c
hashtable.c
obidmscolumn.c
char_str_indexer.c
obidmscolumn_float.c
upperband.c
crc64.c
obidmscolumn_seq.c
obilittlebigman.c
obidmscolumndir.c
obidms.c
obi_ecopcr.c
libecoPCR/libthermo/nnparams.c
libecoPCR/ecoapat.c
libecoPCR/libapat/libstki.c
libecoPCR/libapat/apat_search.c
libecoPCR/libapat/apat_parse.c
libecoPCR/ecodna.c
libecoPCR/ecoMalloc.c
libecoPCR/ecoError.c
obitypes.c
array_indexer.c)
\ No newline at end of file
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