File tree Expand file tree Collapse file tree 4 files changed +13
-11
lines changed
Expand file tree Collapse file tree 4 files changed +13
-11
lines changed Original file line number Diff line number Diff line change 6464
6565 - name : Build wheels
6666 working-directory : ${{github.workspace}}/python
67- run : python -m cibuildwheel --output-dir wheelhouse
67+ run : |
68+ mkdir -p src/sentencepiece/package_data
69+ cp -f ../data/*.bin src/sentencepiece/package_data
70+ python -m cibuildwheel --output-dir wheelhouse
6871 env :
6972 CIBW_ARCHS_LINUX : auto aarch64
7073 CIBW_ARCHS_MACOS : x86_64 universal2 arm64
Original file line number Diff line number Diff line change 88 cp -f -R " ../${i} " sentencepiece
99done
1010
11- mkdir -p sentencepiece/data
12- cp -f ../data/* .bin sentencepiece/data
13-
1411python3 setup.py sdist
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
66name = " sentencepiece"
77version = " 0.2.1"
88authors = [
9- { name =" Taku Kudo" , email =" taku@gogle .com" },
9+ { name =" Taku Kudo" , email =" taku@google .com" },
1010]
1111description = " Unsupervised text tokenizer and detokenizer."
1212readme = " README.md"
Original file line number Diff line number Diff line change @@ -115,10 +115,15 @@ def copy_package_data():
115115
116116 package_data = os .path .join ('src' , 'sentencepiece' , 'package_data' )
117117
118+ if not os .path .exists (package_data ):
119+ os .makedirs (package_data )
120+
121+ if glob .glob (os .path .join (package_data , '*.bin' )):
122+ return
123+
118124 def find_targets (roots ):
119125 for root in roots :
120- data = glob .glob (os .path .join (root , '*.bin' ))
121- if len (data ) != 0 :
126+ if glob .glob (os .path .join (root , '*.bin' )):
122127 return data
123128 return []
124129
@@ -128,12 +133,9 @@ def find_targets(roots):
128133 '../data' ,
129134 ])
130135
131- if len ( data ) == 0 and is_sentencepiece_installed ():
136+ if not data and is_sentencepiece_installed ():
132137 data = find_targets (run_pkg_config ('datadir' ))
133138
134- if not os .path .exists (package_data ):
135- os .makedirs (package_data )
136-
137139 for filename in data :
138140 print ('copying {} -> {}' .format (filename , package_data ))
139141 shutil .copy (filename , package_data )
You can’t perform that action at this time.
0 commit comments