9 import os, sys, glob, shutil
14 samtools_exclude = ( "bamtk.c", "razip.c", "bgzip.c" )
15 samtools_dest = os.path.abspath( "samtools" )
17 # copy samtools source
18 if len(sys.argv) >= 2 and sys.argv[1] == "import":
19 if len(sys.argv) < 3: raise ValueError("missing PATH to samtools source directory")
20 samtools_src = os.path.abspath( sys.argv[2] )
21 if not os.path.exists( samtools_src ): raise IOError( "samtools src dir `%s` does not exist." % samtools_src )
23 cfiles = glob.glob( os.path.join( samtools_src, "*.c" ) )
24 hfiles = glob.glob( os.path.join( samtools_src, "*.h" ) )
26 for p in cfiles + hfiles:
27 f = os.path.basename(p)
28 if f in samtools_exclude: continue
29 if os.path.exists( os.path.join( samtools_dest, f )): continue
30 shutil.copy( p, samtools_dest )
32 print "installed latest source code from %s: %i files copied" % (samtools_src, ncopied)
35 from distutils.core import setup, Extension
36 from Pyrex.Distutils import build_ext
39 Development Status :: 2 - Alpha
40 Operating System :: MacOS :: MacOS X
41 Operating System :: Microsoft :: Windows :: Windows NT/2000
42 Operating System :: OS Independent
43 Operating System :: POSIX
44 Operating System :: POSIX :: Linux
45 Operating System :: Unix
46 Programming Language :: Python
47 Topic :: Scientific/Engineering
48 Topic :: Scientific/Engineering :: Bioinformatics
52 "pysam/csamtools", # name of extension
53 [ "pysam/csamtools.pyx" ] +\
54 [ "pysam/%s" % x for x in (
56 glob.glob( os.path.join( "samtools", "*.c" ) ),
58 include_dirs=[ "samtools", ],
66 'description': "pysam",
67 'long_description': __doc__,
68 'author': "Andreas Heger",
69 'author_email': "andreas.heger@gmail.com",
72 'url': "http://code.google.com/p/pysam/",
74 "pysam/__init__", "pysam/Pileup", "pysam/namedtuple" ],
75 'ext_modules': [pysam,],
76 'cmdclass' : {'build_ext': build_ext} }
78 if __name__=='__main__':
79 dist = setup(**metadata)