-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathsetup.py
More file actions
71 lines (62 loc) · 2.34 KB
/
setup.py
File metadata and controls
71 lines (62 loc) · 2.34 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
from setuptools import setup, Extension, find_packages
# require pysam is pre-installed
try:
import pysam
except ImportError:
raise Exception('pysam not found; please install pysam first')
from distutils.version import LooseVersion
required_pysam_version = '0.15'
if LooseVersion(pysam.__version__) < LooseVersion(required_pysam_version):
raise Exception('pysam version >= %s is required; found %s' %
(required_pysam_version, pysam.__version__))
def get_version():
"""Extract version number from source file."""
from ast import literal_eval
with open('pysamstats/__init__.py') as f:
for line in f:
if line.startswith('__version__'):
return literal_eval(line.partition('=')[2].lstrip())
raise ValueError("__version__ not found")
try:
from Cython.Build import cythonize
print('[pysamstats] build with Cython')
extensions = cythonize([
Extension('pysamstats.opt',
sources=['pysamstats/opt.pyx'],
include_dirs=pysam.get_include(),
define_macros=pysam.get_defines())]
)
except ImportError:
print('[pysamstats] build from C')
extensions = [Extension('pysamstats.opt',
sources=['pysamstats/opt.c'],
include_dirs=pysam.get_include(),
define_macros=pysam.get_defines())]
setup(
name='pysamstats',
version=get_version(),
author='Alistair Miles',
author_email='alimanfoo@googlemail.com',
url='https://github.com/alimanfoo/pysamstats',
license='MIT Licenses',
description='A Python utility for calculating statistics against genome '
'position based on sequence alignments from a SAM, '
'BAM or CRAM file.',
scripts=['scripts/pysamstats'],
package_dir={'': '.'},
install_requires=[
"pysam (<0.16)",
"numpy",
],
packages=find_packages(),
classifiers=[
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Topic :: Software Development :: Libraries :: Python Modules'
],
ext_modules=extensions,
)