* Use headers_workaround to avoid having install dependencies, given setuptools bug 209.

This commit is contained in:
Matthew Honnibal 2015-01-04 21:14:07 +11:00
parent 27c737a80f
commit 0cd7652545
3 changed files with 24 additions and 25 deletions

View File

@ -6,7 +6,7 @@ python:
# command to install dependencies # command to install dependencies
install: install:
- "pip install --upgrade setuptools" - "pip install --upgrade setuptools"
- "pip install murmurhash numpy spacy" - "pip install spacy"
- "rm -rf spacy/" - "rm -rf spacy/"
# command to run tests # command to run tests
script: "py.test tests/" script: "py.test tests/"

13
fabfile.py vendored
View File

@ -13,6 +13,7 @@ DEV_ENV_DIR = path.join(PWD, '.denv')
def require_dep(name): def require_dep(name):
local('pip install %s' % name) local('pip install %s' % name)
def dev(): def dev():
# Allow this to persist, since we aren't as rigorous about keeping state clean # Allow this to persist, since we aren't as rigorous about keeping state clean
if not file_exists('.denv'): if not file_exists('.denv'):
@ -45,8 +46,6 @@ def setup():
local('virtualenv .env') local('virtualenv .env')
with virtualenv(VENV_DIR): with virtualenv(VENV_DIR):
local('pip install --upgrade setuptools') local('pip install --upgrade setuptools')
local('pip install murmurhash')
local('pip install numpy')
def install(): def install():
@ -56,7 +55,7 @@ def install():
def make(): def make():
with virtualenv(VENV_DIR): with virtualenv(DEV_ENV_DIR):
with lcd(path.dirname(__file__)): with lcd(path.dirname(__file__)):
local('python dev_setup.py build_ext --inplace > /dev/null') local('python dev_setup.py build_ext --inplace > /dev/null')
@ -88,14 +87,6 @@ def docs():
local('make html') local('make html')
def sbox():
local('python sb_setup.py build_ext --inplace')
def sbclean():
local('python sb_setup.py clean --all')
def pos(): def pos():
local('rm -rf data/en/pos') local('rm -rf data/en/pos')
local('python tools/train.py pos ~/work_data/docparse/wsj02-21.conll data/en/pos') local('python tools/train.py pos ~/work_data/docparse/wsj02-21.conll data/en/pos')

View File

@ -3,8 +3,7 @@ import sys
import os import os
from os import path from os import path
from glob import glob from glob import glob
import subprocess import sys
import numpy
from setuptools import setup from setuptools import setup
@ -23,22 +22,21 @@ def clean(ext):
os.unlink(html) os.unlink(html)
HERE = os.path.dirname(__file__)
virtual_env = os.environ.get('VIRTUAL_ENV', '')
compile_args = [] compile_args = []
link_args = [] link_args = []
libs = [] libs = []
includes = ['.', numpy.get_include()] includes = ['.']
cython_includes = ['.'] virtual_env = os.environ.get('VIRTUAL_ENV', '')
includes = ['.']
if 'VIRTUAL_ENV' in os.environ: if virtual_env:
includes += glob(path.join(os.environ['VIRTUAL_ENV'], 'include', 'site', '*')) includes += glob(os.path.join(virtual_env, 'include', 'site'))
includes += glob(os.path.join(virtual_env, 'include', 'site', '*'))
else: else:
# If you're not using virtualenv, set your include dir here.
pass pass
ext_args = {'language': "c++", "include_dirs": includes} ext_args = {'language': "c++", "include_dirs": includes}
exts = [ exts = [
@ -83,7 +81,7 @@ setup(
description="Industrial-strength NLP", description="Industrial-strength NLP",
author='Matthew Honnibal', author='Matthew Honnibal',
author_email='honnibal@gmail.com', author_email='honnibal@gmail.com',
version='0.13', version='0.14',
url="http://honnibal.github.io/spaCy/", url="http://honnibal.github.io/spaCy/",
package_data={"spacy": ["*.pxd"], package_data={"spacy": ["*.pxd"],
"spacy.en": ["*.pxd", "data/pos/*", "spacy.en": ["*.pxd", "data/pos/*",
@ -92,7 +90,17 @@ setup(
"spacy.syntax": ["*.pxd"]}, "spacy.syntax": ["*.pxd"]},
ext_modules=exts, ext_modules=exts,
license="Dual: Commercial or AGPL", license="Dual: Commercial or AGPL",
install_requires=['murmurhash', 'cymem', 'preshed', 'thinc', "unidecode", install_requires=['murmurhash', 'numpy', 'cymem', 'preshed', 'thinc', "unidecode",
"ujson"], "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')