-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.py
More file actions
135 lines (122 loc) · 3.94 KB
/
setup.py
File metadata and controls
135 lines (122 loc) · 3.94 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
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
128
129
130
131
132
133
134
135
from setuptools import setup, Extension, find_packages
from os import environ
from setuptools.command.install import install
from setuptools.command.build_ext import build_ext
import sys, os, subprocess
class CustomBuildExt(build_ext):
def run(self):
super().run()
self.fix_rpath()
def fix_rpath(self):
if sys.platform != "darwin":
return
conda_lib = os.path.join(sys.prefix, "lib")
for ext in self.extensions:
so_path = self.get_ext_fullpath(ext.name)
if not os.path.exists(so_path):
continue
subprocess.run(
["install_name_tool", "-delete_rpath", conda_lib, so_path],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
)
subprocess.run(
["install_name_tool", "-delete_rpath", "@loader_path", so_path],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
)
subprocess.run(
["install_name_tool", "-delete_rpath", "@loader_path", so_path],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
)
extra_compile_args = []
extra_link_args = []
if 'darwin' in sys.platform:
extra_compile_args = ['-fopenmp']
extra_link_args = ['-fopenmp']
# clang
# os.environ["CC"] = '/usr/bin/gcc'
os.environ["CC"] = '/opt/homebrew/bin/gcc-12'
else:
if environ.get('CC') and 'clang' in environ['CC']:
# clang
extra_compile_args = ['-fopenmp=libomp']
extra_link_args = ['-fopenmp=libomp']
else:
# GNU
extra_compile_args = ['-fopenmp']
extra_link_args = ['-fopenmp']
MOD1 = 'kssd'
MOD2 = 'nj'
MOD3 = 'dnj'
sources1 = ['co2mco.c',
'iseq2comem.c',
'command_dist_wrapper.c',
'mytime.c',
'global_basic.c',
'command_set.c',
'command_dist.c',
'command_shuffle.c',
'command_composite.c',
'mman.c',
'pykssd.c']
sources2 = ['align.c',
'cluster.c',
'distancemat.c',
'util.c',
'tree.c',
'buildtree.c',
'sequence.c',
'pynj.c']
sources3 = ['bytescale.c',
'dnj.c',
'str.c',
'tmp.c',
'phy.c',
'filebuff.c',
'nj.c',
'qseqs.c',
'vector.c',
'matrix.c',
'mman.c',
'hclust.c',
'nwck.c',
'pherror.c',
'pydnj.c']
include_dirs1 = ['kssdheaders']
include_dirs2 = ['njheaders']
include_dirs3 = ['dnjheaders']
require_pakages = [
'pyqt5',
'ete3',
'requests',
'pandas'
]
setup(
name='kssdtree',
version='2.1.0',
author='Hang Yang',
author_email='yhlink1207@gmail.com',
description="Kssdtree is a versatile Python package for phylogenetic analysis. It also provides one-stop tree construction and visualization. It can handle DNA sequences of both fasta or fastq format, whether gzipped or not. ",
url='https://github.com/yhlink/kssdtree',
download_url='https://pypi.org/project/kssdtree',
ext_modules=[
Extension(MOD1, sources=sources1, include_dirs=include_dirs1, libraries=['z'],
extra_compile_args=extra_compile_args,
extra_link_args=extra_link_args),
Extension(MOD2, sources=sources2, include_dirs=include_dirs2),
Extension(MOD3, sources=sources3, include_dirs=include_dirs3, libraries=['z'],
extra_compile_args=extra_compile_args,
extra_link_args=extra_link_args)
],
py_modules=['kssdtree', 'toolutils'],
packages=find_packages(),
install_requires=require_pakages,
dependency_links=['https://pypi.python.org/simple/'],
zip_safe=False,
include_package_data=True,
cmdclass={
"build_ext": CustomBuildExt,
}
)