-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.py
127 lines (103 loc) · 4.11 KB
/
setup.py
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
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
123
124
125
126
127
#!/usr/bin/env python
# How to build source distribution
# - python setup.py sdist --format bztar
# - python setup.py sdist --format gztar
# - python setup.py sdist --format zip
# - python setup.py bdist_wheel
import os
import sys
import subprocess
from setuptools import setup, find_packages
MAJOR = 0
MINOR = 6
MICRO = 0
VERSION = "{0}.{1}.{2}".format(MAJOR, MINOR, MICRO)
def check_python_version():
"""Checks the python version, exits if < 3.6."""
python_major, python_minor = sys.version_info[:2]
if python_major != 3 or python_minor < 6:
sys.stderr.write(
"genetest requires python 3 (version 3.6 or higher)\n"
)
sys.exit(1)
def write_version_file(fn=None):
if fn is None:
fn = os.path.join(
os.path.dirname(os.path.abspath(__file__)),
os.path.join("genetest", "version.py"),
)
content = ("\n# THIS FILE WAS GENERATED AUTOMATICALLY\n"
'genetest_version = "{version}"\n')
a = open(fn, "w")
try:
a.write(content.format(version=VERSION))
finally:
a.close()
def build_grako_parser():
base = os.path.abspath(
os.path.join(
os.path.dirname(__file__), "genetest", "modelspec"
)
)
target = os.path.join(base, "parser.py")
grammar = os.path.join(base, "modelspec.ebnf")
args = [
"python", "-m", "grako", grammar, "-o", target
]
print("Building modelspec grammar parser.")
print(" ".join(args))
subprocess.check_call(args)
def setup_package():
# Checking the python version prior to installation
check_python_version()
# Saving the version into a file
write_version_file()
# Build the grecko parser.
build_grako_parser()
setup(
name="genetest",
version=VERSION,
description="A package to process and analyze genotypic and "
"phenotypic data.",
long_description="This package provides tools to process and analyse "
"genotypic and phenotypic data using different "
"statistical models. The 'genotypes' and "
"'phenotypes' sub-modules provide interfaces to "
"process genotypes and phenotypes in different "
"format. The 'statistics' sub-module will interface "
"with them to analyze the data using different "
"statistical models.",
url="https://github.com/pgxcentre/genetest",
license="CC BY-NC 4.0",
test_suite="genetest.tests.test_suite",
zip_safe=False,
entry_points={
"console_scripts": [
"genetest=genetest.scripts.cli:main",
"imputed-stats2genetest=genetest.scripts.convert:main",
],
},
install_requires=["numpy >= 1.12.0", "pandas >= 0.19.0",
"setuptools >= 26.1.0", "statsmodels >= 0.8.0",
"grako >= 3.10.0", "scipy >= 0.19.0",
"geneparse >= 0.4.1", "pyyaml >= 3.12"],
packages=find_packages(),
package_data={"genetest.tests": ["data/genotypes/*",
"data/statistics/*"],
"genetest.modelspec": ["modelspec.ebnf"]},
classifiers=["Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"License :: Free for non-commercial use",
"Operating System :: Unix",
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft",
"Programming Language :: Python",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Topic :: Scientific/Engineering :: Bio-Informatics"],
keywords="bioinformatics genetics statistics",
)
if __name__ == "__main__":
setup_package()