2
2
import re
3
3
import subprocess
4
4
import sys
5
+ from glob import glob
5
6
from pathlib import Path
6
7
7
8
from setuptools import Extension , setup , find_packages
@@ -122,6 +123,15 @@ def build_extension(self, ext: CMakeExtension) -> None:
122
123
["cmake" , "--build" , "." , * build_args ], cwd = build_temp , check = True
123
124
)
124
125
126
+ def copy_extensions_to_source (self ):
127
+ super ().copy_extensions_to_source ()
128
+ # Copy the shared library to the lib folder
129
+ so_files = os .path .join (self .build_lib , '*.so' )
130
+ dll_files = os .path .join (self .build_lib , '*.dll' )
131
+ shared_libs = glob (so_files ) + glob (dll_files )
132
+ for file_path in shared_libs :
133
+ filename = os .path .basename (file_path )
134
+ self .copy_file (file_path , (Path .cwd () / 'pywhispercpp' / 'lib' / filename ).resolve ())
125
135
126
136
# read the contents of your README file
127
137
this_directory = Path (__file__ ).parent
@@ -142,6 +152,8 @@ def build_extension(self, ext: CMakeExtension) -> None:
142
152
python_requires = ">=3.8" ,
143
153
packages = find_packages ('.' ),
144
154
package_dir = {'' : '.' },
155
+ include_package_data = True ,
156
+ package_data = {'' : ['./lib/*' ]},
145
157
long_description_content_type = "text/markdown" ,
146
158
license = 'MIT' ,
147
159
entry_points = {
0 commit comments