11import setuptools
2- import re
3- import os
4- import sys
5-
6-
7- def get_shared_lib_path ():
8- for root , dirs , files in os .walk ("build" ):
9- for file in files :
10- if re .search (r"\.(pyd|so|dylib)$" , file ):
11- return os .path .join (root , file )
12- raise FileNotFoundError ("Shared library not found" )
13-
14-
15- def copy_file (src , dst ):
16- with open (src , "rb" ) as f :
17- with open (dst , "wb" ) as g :
18- g .write (f .read ())
19- print (f"Copy { src } to { dst } " )
20-
21-
22- if sys .platform == "darwin" or sys .platform == "win32" :
23- extension = []
24- shared_lib_path = get_shared_lib_path ()
25- print ("###########################" )
26- print (shared_lib_path )
27- print ("###########################" )
28- target_path = "./python/src/fastseqio/_fastseqio"
29- suffix = os .path .splitext (shared_lib_path )[1 ]
30- target_path += suffix
31- copy_file (shared_lib_path , target_path )
32- package_data = {"fastseqio" : ["*.so" , "*.pyd" , "*.dylib" ]}
332
3+ import sys
344
35- elif sys .platform == "linux" :
5+ if sys .platform == "linux" :
366 extension = [
377 setuptools .Extension (
388 "_fastseqio" ,
@@ -42,6 +12,16 @@ def copy_file(src, dst):
4212 )
4313 ]
4414 package_data = {}
15+ elif sys .platform == "win32" :
16+ extension = [
17+ setuptools .Extension (
18+ "_fastseqio" ,
19+ sources = ["./seqio.c" , "./python/fastseqio.cc" ],
20+ include_dirs = ["." , "python/pybind11/include" , "./deps/zlib" ],
21+ extra_objects = ["./zig-out/lib/z.lib" ],
22+ )
23+ ]
24+ package_data = {}
4525else :
4626 raise ValueError ("" )
4727
0 commit comments