* Don't import include files --- use the repository

This commit is contained in:
Matthew Honnibal 2016-02-06 23:59:47 +01:00
parent c6623889c1
commit 860fd11e98

View File

@ -115,36 +115,6 @@ def generate_cython(root, source):
raise RuntimeError('Running cythonize failed')
def import_include(module_name):
try:
return __import__(module_name, globals(), locals(), [], 0)
except ImportError:
raise ImportError('Unable to import %s. Create a virtual environment '
'and install all dependencies from requirements.txt, '
'e.g., run "pip install -r requirements.txt".' % module_name)
def copy_include(src, dst, path):
assert os.path.isdir(src)
assert os.path.isdir(dst)
shutil.copytree(
os.path.join(src, path),
os.path.join(dst, path))
def prepare_includes(path):
include_dir = os.path.join(path, 'include')
if os.path.exists(include_dir):
shutil.rmtree(include_dir)
os.mkdir(include_dir)
numpy = import_include('numpy')
copy_include(numpy.get_include(), include_dir, 'numpy')
murmurhash = import_include('murmurhash')
copy_include(murmurhash.get_include(), include_dir, 'murmurhash')
def is_source_release(path):
return os.path.exists(os.path.join(path, 'PKG-INFO'))
@ -194,7 +164,6 @@ def setup_package():
if not is_source_release(root):
generate_cython(root, 'spacy')
prepare_includes(root)
setup(
name=about['__name__'],