forked from KenLauLab/dropkick
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
102 lines (83 loc) · 2.58 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
# -*- coding: utf-8 -*-
"""
package setup
@author: C Heiser
"""
import sys
import os
import io
import setuptools
from setuptools import setup
try:
from numpy.distutils.core import Extension, setup
except ImportError:
sys.exit(
"install requires: 'numpy'."
" use pip or easy_install."
" \n $ pip install numpy"
)
f_compile_args = ["-ffixed-form", "-fdefault-real-8"]
def read(fname):
with io.open(
os.path.join(os.path.dirname(__file__), fname), encoding="utf-8"
) as _in:
return _in.read()
def get_lib_dir(dylib):
import subprocess
from os.path import realpath, dirname
p = subprocess.Popen(
"gfortran -print-file-name={}".format(dylib),
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
shell=True,
)
retcode = p.wait()
if retcode != 0:
raise Exception("Failed to find {}".format(dylib))
libdir = dirname(realpath(p.communicate()[0].strip().decode("ascii")))
return libdir
if sys.platform == "darwin":
GFORTRAN_LIB = get_lib_dir("libgfortran.3.dylib")
QUADMATH_LIB = get_lib_dir("libquadmath.0.dylib")
ARGS = ["-Wl,-rpath,{}:{}".format(GFORTRAN_LIB, QUADMATH_LIB)]
f_compile_args += ARGS
library_dirs = [GFORTRAN_LIB, QUADMATH_LIB]
else:
library_dirs = None
glmnet_lib = Extension(
name="_glmnet",
sources=["dropkick/_glmnet.pyf", "dropkick/src/glmnet/glmnet5.f90"],
extra_f90_compile_args=f_compile_args,
library_dirs=library_dirs,
)
if __name__ == "__main__":
import versioneer
with open("README.rst", "r") as fh:
long_description = fh.read()
setup(
name="dropkick",
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
description="Automated scRNA-seq filtering",
long_description=long_description,
author="Cody Heiser",
author_email="[email protected]",
url="https://github.com/KenLauLab/dropkick",
install_requires=read("requirements.txt").splitlines(),
ext_modules=[glmnet_lib],
packages=setuptools.find_packages(),
classifiers=[
"Programming Language :: Python :: 3",
"Operating System :: OS Independent",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Topic :: Scientific/Engineering",
],
python_requires=">=3.6",
entry_points={
"console_scripts": [
"dropkick = dropkick.__main__:main"
]
},
)