2014-07-05 22:49:34 +04:00
|
|
|
#!/usr/bin/env python
|
|
|
|
import sys
|
|
|
|
import os
|
|
|
|
from os import path
|
2014-07-25 18:47:27 +04:00
|
|
|
from glob import glob
|
2015-01-03 13:02:10 +03:00
|
|
|
import subprocess
|
2014-12-03 03:06:57 +03:00
|
|
|
import numpy
|
|
|
|
|
2014-07-05 22:49:34 +04:00
|
|
|
|
2015-01-03 13:02:10 +03:00
|
|
|
from setuptools import setup
|
|
|
|
from distutils.core import Extension
|
|
|
|
import shutil
|
|
|
|
|
|
|
|
|
2014-07-05 22:49:34 +04:00
|
|
|
def clean(ext):
|
2015-01-03 13:02:10 +03:00
|
|
|
for src in ext.sources:
|
|
|
|
if src.endswith('.c') or src.endswith('cpp'):
|
|
|
|
so = src.rsplit('.', 1)[0] + '.so'
|
|
|
|
html = src.rsplit('.', 1)[0] + '.html'
|
2014-07-05 22:49:34 +04:00
|
|
|
if os.path.exists(so):
|
|
|
|
os.unlink(so)
|
|
|
|
if os.path.exists(html):
|
|
|
|
os.unlink(html)
|
|
|
|
|
|
|
|
|
|
|
|
HERE = os.path.dirname(__file__)
|
|
|
|
virtual_env = os.environ.get('VIRTUAL_ENV', '')
|
|
|
|
compile_args = []
|
|
|
|
link_args = []
|
|
|
|
libs = []
|
|
|
|
|
2014-12-03 03:06:57 +03:00
|
|
|
includes = ['.', numpy.get_include()]
|
2014-08-16 01:56:57 +04:00
|
|
|
cython_includes = ['.']
|
2014-07-05 22:49:34 +04:00
|
|
|
|
2014-07-25 18:47:27 +04:00
|
|
|
|
|
|
|
if 'VIRTUAL_ENV' in os.environ:
|
|
|
|
includes += glob(path.join(os.environ['VIRTUAL_ENV'], 'include', 'site', '*'))
|
|
|
|
else:
|
|
|
|
# If you're not using virtualenv, set your include dir here.
|
|
|
|
pass
|
|
|
|
|
2014-12-20 22:03:53 +03:00
|
|
|
ext_args = {'language': "c++", "include_dirs": includes}
|
2014-07-25 18:47:27 +04:00
|
|
|
|
2014-07-05 22:49:34 +04:00
|
|
|
exts = [
|
2015-01-03 13:02:10 +03:00
|
|
|
Extension("spacy.typedefs", ["spacy/typedefs.cpp"], **ext_args),
|
|
|
|
Extension("spacy.strings", ["spacy/strings.cpp"], **ext_args),
|
|
|
|
Extension("spacy.lexeme", ["spacy/lexeme.cpp"], **ext_args),
|
|
|
|
Extension("spacy.vocab", ["spacy/vocab.cpp"], **ext_args),
|
|
|
|
Extension("spacy.tokens", ["spacy/tokens.cpp"], **ext_args),
|
|
|
|
Extension("spacy.morphology", ["spacy/morphology.cpp"], **ext_args),
|
|
|
|
|
|
|
|
Extension("spacy._ml", ["spacy/_ml.cpp"], **ext_args),
|
|
|
|
|
|
|
|
Extension("spacy.tokenizer", ["spacy/tokenizer.cpp"], **ext_args),
|
|
|
|
Extension("spacy.en.attrs", ["spacy/en/attrs.cpp"], **ext_args),
|
|
|
|
Extension("spacy.en.pos", ["spacy/en/pos.cpp"], **ext_args),
|
|
|
|
Extension("spacy.syntax.parser", ["spacy/syntax/parser.cpp"], **ext_args),
|
|
|
|
Extension("spacy.syntax._state", ["spacy/syntax/_state.cpp"], **ext_args),
|
|
|
|
Extension("spacy.syntax.arc_eager", ["spacy/syntax/arc_eager.cpp"], **ext_args),
|
|
|
|
Extension("spacy.syntax._parse_features", ["spacy/syntax/_parse_features.cpp"],
|
2014-12-23 07:18:20 +03:00
|
|
|
**ext_args)
|
2014-12-17 13:10:12 +03:00
|
|
|
|
2014-12-03 03:06:57 +03:00
|
|
|
#Extension("spacy.pos_feats", ["spacy/pos_feats.pyx"], language="c++", include_dirs=includes),
|
|
|
|
#Extension("spacy.ner._state", ["spacy/ner/_state.pyx"], language="c++", include_dirs=includes),
|
|
|
|
#Extension("spacy.ner.bilou_moves", ["spacy/ner/bilou_moves.pyx"], language="c++", include_dirs=includes),
|
|
|
|
#Extension("spacy.ner.io_moves", ["spacy/ner/io_moves.pyx"], language="c++", include_dirs=includes),
|
|
|
|
#Extension("spacy.ner.greedy_parser", ["spacy/ner/greedy_parser.pyx"], language="c++", include_dirs=includes),
|
|
|
|
#Extension("spacy.ner.pystate", ["spacy/ner/pystate.pyx"], language="c++", include_dirs=includes),
|
|
|
|
#Extension("spacy.ner.context", ["spacy/ner/context.pyx"], language="c++", include_dirs=includes),
|
|
|
|
#Extension("spacy.ner.feats", ["spacy/ner/feats.pyx"], language="c++", include_dirs=includes),
|
|
|
|
#Extension("spacy.ner.annot", ["spacy/ner/annot.pyx"], language="c++", include_dirs=includes),
|
2014-07-05 22:49:34 +04:00
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
if sys.argv[1] == 'clean':
|
|
|
|
print >> sys.stderr, "cleaning .c, .c++ and .so files matching sources"
|
|
|
|
map(clean, exts)
|
|
|
|
|
2015-01-03 13:02:10 +03:00
|
|
|
|
|
|
|
setup(
|
2014-10-22 03:17:26 +04:00
|
|
|
name='spacy',
|
2015-01-02 13:56:43 +03:00
|
|
|
packages=['spacy', 'spacy.en', 'spacy.syntax'],
|
|
|
|
description="Industrial-strength NLP",
|
2014-07-05 22:49:34 +04:00
|
|
|
author='Matthew Honnibal',
|
|
|
|
author_email='honnibal@gmail.com',
|
2015-01-03 17:59:14 +03:00
|
|
|
version='0.13',
|
2015-01-02 13:56:43 +03:00
|
|
|
url="http://honnibal.github.io/spaCy/",
|
2015-01-03 13:02:10 +03:00
|
|
|
package_data={"spacy": ["*.pxd"],
|
|
|
|
"spacy.en": ["*.pxd", "data/pos/*",
|
|
|
|
"data/wordnet/*", "data/tokenizer/*",
|
|
|
|
"data/vocab/*"],
|
2015-01-02 13:56:43 +03:00
|
|
|
"spacy.syntax": ["*.pxd"]},
|
2014-07-05 22:49:34 +04:00
|
|
|
ext_modules=exts,
|
2015-01-03 13:02:10 +03:00
|
|
|
license="Dual: Commercial or AGPL",
|
|
|
|
install_requires=['murmurhash', 'cymem', 'preshed', 'thinc', "unidecode",
|
2015-01-03 17:59:14 +03:00
|
|
|
"ujson"],
|
|
|
|
setup_requires=["murmurhash", "numpy"],
|
2014-07-05 22:49:34 +04:00
|
|
|
)
|