From 67095375e492b02ca75348f84b28acc5a40be387 Mon Sep 17 00:00:00 2001 From: Dom Hudson Date: Tue, 8 May 2018 17:18:49 +0100 Subject: [PATCH] Fixing setup.py see https://github.com/pybind/python_example/issues/32 --- setup.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index f525751de..a994ed986 100644 --- a/setup.py +++ b/setup.py @@ -12,17 +12,26 @@ from __future__ import print_function from __future__ import unicode_literals +import os +import setuptools from setuptools import setup, Extension from setuptools.command.build_ext import build_ext +import subprocess import sys -import setuptools -import os + __version__ = '0.8.22' FASTTEXT_SRC = "src" -# Based on https://github.com/pybind/python_example +try: + import pybind11 +except ImportError: + if subprocess.call([sys.executable, '-m', 'pip', 'install', 'pybind11']): + raise RuntimeError('pybind11 install failed.') + + +# Based on https://github.com/pybind/python_example class get_pybind_include(object): """Helper class to determine the pybind11 include path