From: Kentaro Hayashi Date: Thu, 11 Feb 2021 08:39:41 +0000 (+0900) Subject: Support to build Python module without pkg-config X-Git-Tag: archive/raspbian/0.1.97-2+rpi1~3 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=98b555e03cbe91f736dcc9ae08c189113d18392e;p=sentencepiece.git Support to build Python module without pkg-config Gbp-Pq: Name support-python-module-in-place.patch --- diff --git a/python/setup.py b/python/setup.py index 79f2691..d1c53b3 100755 --- a/python/setup.py +++ b/python/setup.py @@ -65,17 +65,19 @@ class build_ext(_build_ext): def build_extension(self, ext): pkg_config_path = None - if not is_sentencepiece_installed(): - subprocess.check_call(['./build_bundled.sh', version()]) - pkg_config_path = './bundled/lib/pkgconfig:./bundled/lib64/pkgconfig' + #if not is_sentencepiece_installed(): + # subprocess.run(['./build_bundled.sh', version()], check=True) + # pkg_config_path = './bundled/lib/pkgconfig:./bundled/lib64/pkgconfig' cflags = ['-std=c++11'] # Fix compile on some versions of Mac OSX # See: https://github.com/neulab/xnmt/issues/199 if sys.platform == 'darwin': cflags.append('-mmacosx-version-min=10.9') - cflags = cflags + run_pkg_config('cflags', pkg_config_path) - libs = run_pkg_config('libs', pkg_config_path) + cflags = cflags + ["-I../src"] + cmd = "dpkg-architecture -q DEB_BUILD_GNU_TYPE" + arch = subprocess.check_output(cmd, shell=True).decode("utf-8").strip().split()[0] + libs = ["-L../obj-%s/src" % arch, "-lsentencepiece", "-lsentencepiece_train"] print('## cflags={}'.format(' '.join(cflags))) print('## libs={}'.format(' '.join(libs))) ext.extra_compile_args = cflags