From d8c4b0405649d788a46744c646be85d83823f01c Mon Sep 17 00:00:00 2001 From: Taku Kudo Date: Thu, 22 Oct 2020 09:49:33 +0900 Subject: [PATCH] Fixed build error on Mac. --- .gitignore | 1 + python/MANIFEST.in | 4 ++-- python/make_py_wheel.sh | 2 +- python/setup.py | 8 +++++--- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 367bdb8..20073e7 100644 --- a/.gitignore +++ b/.gitignore @@ -70,3 +70,4 @@ m.vocab cmake_install.cmake libsentencepiece.so* libsentencepiece_train.so* +python/bundled diff --git a/python/MANIFEST.in b/python/MANIFEST.in index 9d9603f..c182f30 100644 --- a/python/MANIFEST.in +++ b/python/MANIFEST.in @@ -1,3 +1,3 @@ recursive-include test *.py *.model botchan.txt -include *.i *.md VERSION -include build_bundled.sh +recursive-include src *.i +include *.md VERSION build_bundled.sh diff --git a/python/make_py_wheel.sh b/python/make_py_wheel.sh index 303eef3..79aeb45 100755 --- a/python/make_py_wheel.sh +++ b/python/make_py_wheel.sh @@ -42,7 +42,7 @@ build() { for i in /opt/python/* do $i/bin/python setup.py bdist - strip build/*/*.so + strip build/*/*/*.so $i/bin/python setup.py bdist_wheel $i/bin/python setup.py test rm -fr build diff --git a/python/setup.py b/python/setup.py index e223fea..1e9bf07 100755 --- a/python/setup.py +++ b/python/setup.py @@ -53,9 +53,11 @@ def run_pkg_config(section, pkg_config_path=None): def is_sentencepiece_installed(): - return subprocess.run( - 'pkg-config sentencepiece --libs', shell=True, - check=False).returncode == 0 + try: + subprocess.check_call('pkg-config sentencepiece --libs', shell=True) + return True + except subprocess.CalledProcessError: + return False class build_ext(_build_ext):