-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
57 lines (49 loc) · 1.66 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
import setuptools
import platform
import re
import os
def get_shared_lib_path():
for root, dirs, files in os.walk("build"):
for file in files:
if re.search(r"\.(pyd|so|dylib)$", file):
return os.path.join(root, file)
raise FileNotFoundError("Shared library not found")
def copy_file(src, dst):
with open(src, "rb") as f:
with open(dst, "wb") as g:
g.write(f.read())
print(f"Copy {src} to {dst}")
if platform.system() == "Darwin" or platform.system() == "Windows":
extension = []
shared_lib_path = get_shared_lib_path()
print("###########################")
print(shared_lib_path)
print("###########################")
target_path = "./python/src/fastseqio/_fastseqio"
suffix = os.path.splitext(shared_lib_path)[1]
target_path += suffix
copy_file(shared_lib_path, target_path)
package_data = {"fastseqio": ["*.so", "*.pyd", "*.dylib"]}
elif platform.system() == "Linux":
extension = [
setuptools.Extension(
"_fastseqio",
sources=["./seqio.c", "./python/fastseqio.cc"],
include_dirs=[".", "python/pybind11/include"],
extra_link_args=["-lz"],
)
]
package_data = {}
setuptools.setup(
name="fastseqio",
version="0.0.7",
author="dwpeng",
author_email="[email protected]",
license="MIT",
url="https://github.com/dwpeng/fastseqio",
description="A package for reading and writing fasta/fastq files",
packages=setuptools.find_namespace_packages(where="./python/src"),
package_dir={"": "./python/src"},
ext_modules=extension,
package_data=package_data, # type: ignore
)