diff --git a/.travis.yml b/.travis.yml index 41d0c5aab..4b88ba216 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ python: # command to install dependencies install: - "pip install --upgrade setuptools" - - "pip install murmurhash numpy spacy" + - "pip install spacy" - "rm -rf spacy/" # command to run tests script: "py.test tests/" diff --git a/fabfile.py b/fabfile.py index c1a61d48a..f3a8a8712 100644 --- a/fabfile.py +++ b/fabfile.py @@ -13,6 +13,7 @@ DEV_ENV_DIR = path.join(PWD, '.denv') def require_dep(name): local('pip install %s' % name) + def dev(): # Allow this to persist, since we aren't as rigorous about keeping state clean if not file_exists('.denv'): @@ -45,8 +46,6 @@ def setup(): local('virtualenv .env') with virtualenv(VENV_DIR): local('pip install --upgrade setuptools') - local('pip install murmurhash') - local('pip install numpy') def install(): @@ -56,7 +55,7 @@ def install(): def make(): - with virtualenv(VENV_DIR): + with virtualenv(DEV_ENV_DIR): with lcd(path.dirname(__file__)): local('python dev_setup.py build_ext --inplace > /dev/null') @@ -88,14 +87,6 @@ def docs(): local('make html') -def sbox(): - local('python sb_setup.py build_ext --inplace') - - -def sbclean(): - local('python sb_setup.py clean --all') - - def pos(): local('rm -rf data/en/pos') local('python tools/train.py pos ~/work_data/docparse/wsj02-21.conll data/en/pos') diff --git a/setup.py b/setup.py index c40d0f118..1421b241a 100644 --- a/setup.py +++ b/setup.py @@ -3,8 +3,7 @@ import sys import os from os import path from glob import glob -import subprocess -import numpy +import sys from setuptools import setup @@ -23,22 +22,21 @@ def clean(ext): os.unlink(html) -HERE = os.path.dirname(__file__) -virtual_env = os.environ.get('VIRTUAL_ENV', '') compile_args = [] link_args = [] libs = [] -includes = ['.', numpy.get_include()] -cython_includes = ['.'] +includes = ['.'] +virtual_env = os.environ.get('VIRTUAL_ENV', '') - -if 'VIRTUAL_ENV' in os.environ: - includes += glob(path.join(os.environ['VIRTUAL_ENV'], 'include', 'site', '*')) +includes = ['.'] +if virtual_env: + includes += glob(os.path.join(virtual_env, 'include', 'site')) + includes += glob(os.path.join(virtual_env, 'include', 'site', '*')) else: - # If you're not using virtualenv, set your include dir here. pass + ext_args = {'language': "c++", "include_dirs": includes} exts = [ @@ -83,7 +81,7 @@ setup( description="Industrial-strength NLP", author='Matthew Honnibal', author_email='honnibal@gmail.com', - version='0.13', + version='0.14', url="http://honnibal.github.io/spaCy/", package_data={"spacy": ["*.pxd"], "spacy.en": ["*.pxd", "data/pos/*", @@ -92,7 +90,17 @@ setup( "spacy.syntax": ["*.pxd"]}, ext_modules=exts, license="Dual: Commercial or AGPL", - install_requires=['murmurhash', 'cymem', 'preshed', 'thinc', "unidecode", + install_requires=['murmurhash', 'numpy', 'cymem', 'preshed', 'thinc', "unidecode", "ujson"], - setup_requires=["murmurhash", "numpy"], + setup_requires=["headers_workaround"], ) + + +import headers_workaround + + +include_dir = path.join(sys.prefix, 'include', 'site') +if not path.exists(include_dir): + os.mkdir(include_dir) +headers_workaround.install_headers(include_dir, 'murmurhash') +headers_workaround.install_headers(include_dir, 'numpy')