setup.py 3.56 KB
Newer Older
Tristan BF's avatar
Tristan BF committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#!/usr/bin/env python

import os,sys, shlex, subprocess
from os.path import join
import platform
import distutils
from distutils import sysconfig
from setuptools import find_packages
from distutils.core import setup, Extension

cfgDict = distutils.sysconfig.get_config_vars()


progcompiler = 'g++ --std=c++0x'
sources='src/compute_similarity.cpp'

T-B-F's avatar
T-B-F committed
17
cmd = '%s %s -o src/compute_similarity -I%s %s -L%s -lpython%s %s %s' % \
Tristan BF's avatar
Tristan BF committed
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
    (progcompiler, 
    cfgDict['LINKFORSHARED'],
    cfgDict['INCLUDEPY'],
    sources,
    cfgDict['LIBPL'],
    cfgDict['VERSION'], 
    cfgDict['LIBS'], 
    cfgDict['LIBM'])
    
# compile compute_similarity software
#print 'cmd = ', cmd 
cmd = shlex.split( cmd )
try :
    subprocess.check_call( cmd )
except subprocess.CalledProcessError as e :
    print >>sys.stderr, e.output
    print >>sys.stderr, e.cmd
    sys.exit( 1 )
except SystemExit as e :
    ext = e.code
    sys.exit( ext )
except :
    print >>sys.stderr, "Unexpected error:", sys.exc_info()[0]
    sys.exit(1)

try:
    import networkx
except ImportError:
    sys.stderr.write('networkx is not installed, you can find it at: '
                     'http://networkx.lanl.gov/\n')
    sys.exit(1)

try:
    import numpy
except ImportError:
    sys.stderr.write('numpy is not installed, you can find it at: '
                     'http://numpy.scipy.org\n')
    sys.exit(1)

try:
    import Pycluster
except ImportError:
    sys.stderr.write('pycluster is not installed you can find it at: '
                     'http://bonsai.hgc.jp/~mdehoon/software/cluster/software.htm#pycluster\n')
    sys.exit(1)

__version__ = ''
65
with open('lib/porthoDom/__init__.py') as inp:
Tristan BF's avatar
Tristan BF committed
66 67 68 69 70
  for line in inp:
      if line.startswith('__version__'):
          exec(line.strip())
          break
          
71
PACKAGES = [ 'porthoDom',]
Tristan BF's avatar
Tristan BF committed
72 73 74 75 76 77 78 79 80

PACKAGE_DATA = {
    'data': ['*.dat',]
}

PACKAGE_DIR = {}
for pkg in PACKAGES:
    PACKAGE_DIR[pkg] = join('lib', *pkg.split('.'))

81
SCRIPTS = ['scripts/porthoDom']
Tristan BF's avatar
Tristan BF committed
82 83 84 85 86 87 88 89 90 91 92

if (platform.system() == 'Windows' or 
    len(sys.argv) > 1 and sys.argv[1] not in ('build', 'install')):
    for script in list(SCRIPTS):
        SCRIPTS.append(script + '.bat')

#extension = Extension('compute_similarity', 
#                      sources = ['src/compute_similarity.cpp'],
#                      extra_compile_args = ['--std=c++0x'] )

setup(
93
    name='porthoDom',
Tristan BF's avatar
Tristan BF committed
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
    version=__version__,
    author='Tristan Bitard-Feildel',
    author_email='t.bitard.feildel@uni-muenster.de',
    url='http://www.bornberglab.org/',
    description='A Python Package for proteinortho used with protein domain ',
    long_description="",
    packages=PACKAGES,
    package_dir=PACKAGE_DIR,
    package_data=PACKAGE_DATA,
    license='GPL',
    keywords=('protein, domain, orthology, '
              'domain arrangement, domain similarity, '),
    classifiers=[
                 'Development Status :: 5 - Production/Stable',
                 'Intended Audience :: Education',
                 'Intended Audience :: Science/Research',
                 'License :: OSI Approved :: GPL License',
                 'Operating System :: MacOS',
                 'Operating System :: Microsoft :: Windows',
                 'Operating System :: POSIX',
                 'Programming Language :: Python',
                 'Programming Language :: Python :: 2',
                 'Topic :: Scientific/Engineering :: Bio-Informatics',
                ],
    scripts=SCRIPTS,
    requires= ['NumPy (>=1.6.2)',
               'Networkx (>=1.7)',
               'Matplotlib (>=1.1)',
               'Pycluster (>=1.49)',],
123
    provides=['porthoDom ({0:s})'.format(__version__)],
Tristan BF's avatar
Tristan BF committed
124 125 126 127 128
)