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
|
#!/usr/bin/python
from distutils import sysconfig
from distutils.core import setup, Extension
import os
import platform
import sys
# lkajan: we follow the example of libtorrent-rasterbar here - thank you very much for that!
def parse_cmd(cmdline, prefix, keep_prefix = False):
ret = []
for token in cmdline.split():
if token[:len(prefix)] == prefix:
if keep_prefix:
ret.append(token)
else:
ret.append(token[len(prefix):])
return ret
config_vars = sysconfig.get_config_vars()
if "CFLAGS" in config_vars and "-Wstrict-prototypes" in config_vars["CFLAGS"]:
config_vars["CFLAGS"] = config_vars["CFLAGS"].replace("-Wstrict-prototypes", " ")
if "OPT" in config_vars and "-Wstrict-prototypes" in config_vars["OPT"]:
config_vars["OPT"] = config_vars["OPT"].replace("-Wstrict-prototypes", " ")
source_list = os.listdir(os.path.join(os.path.dirname(__file__), "src"))
source_list = [os.path.join("src", s) for s in source_list if s.endswith(".C")]
# g++ -O -fPIC -ansi -Werror -Wall -Wno-deprecated -DHAVE_STRCASECMP -DINCL_TEMPLATE_SRC -DHAVE_PLACEMENT_NEW -I./include -I../include -I/usr/include/python2.7 -I/apps/boost/include/boost-1_41 -ftemplate-depth-128 -fno-inline -Wall -c src/TypeCodePyWrap.C -o ./obj/TypeCodePyWrap.o
# g++ -shared -L/apps/boost/lib -L/apps/xerces-3.0.1/lib TypeCodePyWrap.o StlPyWrap.o CharPyWrap.o RcsbFilePyWrap.o ISTablePyWrap.o TableFilePyWrap.o CifFilePyWrap.o DicFilePyWrap.o DictObjFilePyWrap.o DataInfoPyWrap.o CifDataInfoPyWrap.o DictDataInfoPyWrap.o PdbMlFilePyWrap.o CorePyWrap.o -L../../lib/.libs -lrcsb-core-wrapper -lboost_python-mt-py27 -lxerces-c -lutil -lpthread -ldl -o ../lib/CorePyWrap.so
extra_cmd = '@DEFINES@'
setup( name='python-corepywrap',
version='1.000',
author = 'RCSB PDB Software Team',
author_email='sw-help@rcsb.rutgers.edu',
description = 'Python bindings for librcsb-core-wrapper',
long_description = 'Python bindings for librcsb-core-wrapper',
url = 'http://sw-tools.rcsb.org/apps/CORE-WRAPPER/index.html',
platforms = 'any',
license = 'RCSB PDB SOFTWARE LICENSE AGREEMENT',
ext_modules = [Extension('CorePyWrap',
sources = source_list,
language='c++',
include_dirs = ['../../include'] + parse_cmd(extra_cmd, '-I'),
library_dirs = ['../../lib/.libs'] + parse_cmd(extra_cmd, '-L'),
extra_compile_args = parse_cmd(extra_cmd, '-D', True),
libraries = ['rcsb-core-wrapper', 'boost_python-py%1d%1d' % ( sys.version_info[0], sys.version_info[1] )] + parse_cmd(extra_cmd, '-l'))],
)
|