Skip to content

Commit c2136ac

Browse files
committed
stop using before-build, but copy data in actions
1 parent 1c09722 commit c2136ac

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

.github/workflows/wheel.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ jobs:
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

python/build_sdist.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,4 @@ do
88
cp -f -R "../${i}" sentencepiece
99
done
1010

11-
mkdir -p sentencepiece/data
12-
cp -f ../data/*.bin sentencepiece/data
13-
1411
python3 setup.py sdist

python/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
66
name = "sentencepiece"
77
version = "0.2.1"
88
authors = [
9-
{ name="Taku Kudo", email="taku@gogle.com" },
9+
{ name="Taku Kudo", email="taku@google.com" },
1010
]
1111
description = "Unsupervised text tokenizer and detokenizer."
1212
readme = "README.md"

python/setup.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff 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)

0 commit comments

Comments
 (0)