(section, pkg_config_path=None)
| 40 | |
| 41 | |
| 42 | def run_pkg_config(section, pkg_config_path=None): |
| 43 | try: |
| 44 | cmd = 'pkg-config sentencepiece --{}'.format(section) |
| 45 | if pkg_config_path: |
| 46 | cmd = 'env PKG_CONFIG_PATH={} {}'.format(pkg_config_path, cmd) |
| 47 | output = subprocess.check_output(cmd, shell=True) |
| 48 | if sys.version_info >= (3, 0, 0): |
| 49 | output = output.decode('utf-8') |
| 50 | except subprocess.CalledProcessError: |
| 51 | sys.stderr.write('Failed to find sentencepiece pkg-config\n') |
| 52 | sys.exit(1) |
| 53 | return output.strip().split() |
| 54 | |
| 55 | |
| 56 | def is_sentencepiece_installed(): |
no test coverage detected