给出docker
,see details
tox==3.13.2
和++pip install tox
Requirement already satisfied: tox in /home/travis/virtualenv/python3.7.1/lib/python3.7/site-packages (3.13.2)
:
tox.ini
特别是:
[tox]
envlist =
py-cythonized
[testenv]
; simplify numpy installation
setenv =
LAPACK=
ATLAS=None
PYTHONWARNINGS=ignore
; Copy all environment variables to the tox test environment
passenv = *
deps =
py-cythonized: Cython >= 0.28.5
changedir = nltk/test
commands =
; scipy and scikit-learn requires numpy even to run setup.py so
; they can't be installed in one command
pip install scipy scikit-learn
; python runtests.py --with-coverage --cover-inclusive --cover-package=nltk --cover-html --cover-html-dir={envdir}/docs []
python runtests.py []
使用# Test Cython compiled installation.
[testenv:py-cythonized]
setenv =
CYTHONIZE_NLTK = "true"
NLTK_DATA = {homedir}/nltk_data/
extras = all
passenv =
CYTHONIZE_NLTK
commands =
{toxinidir}/tools/travis/coverage-pylint.sh
测试时,应该传递CYTHONIZE_NLTK
变量
我的tox -e py-cythonize tox.ini -vv
检查了CYTHONIZE_NLTK
变量以添加扩展模块setup.py
:
ext_modules
但是从配置项看来,当毒物进行MODULES_TO_COMPILE = [
#'nltk.ccg.*', # Fails on https://travis-ci.org/nltk/nltk/jobs/529589821#L2077
'nltk.chat.*',
'nltk.chunk.*',
def compile_modules(modules):
"""
Compile the named modules using Cython, using the clearer Python 3 semantics.
"""
import Cython
from Cython.Build import cythonize
files = [name.replace('.', os.path.sep) + '.py' for name in modules]
print("Compiling %d modules using Cython %s" % (len(modules), Cython.__version__))
return cythonize(files, language_level=3)
print('PRINTING ENVIRON...')
print(os.environ)
if os.getenv('CYTHONIZE_NLTK') == 'true':
ext_modules = compile_modules(MODULES_TO_COMPILE)
else:
ext_modules = None
setup(
name="nltk",
extras_require=extras_require,
packages=find_packages(),
ext_modules=ext_modules,
zip_safe=False, # since normal files will be present too?
entry_points=console_scripts,
)
时,CYTHONIZE_NLTK
似乎没有被识别:
install_command
有关https://travis-ci.org/nltk/nltk/jobs/578224159#L1988的更多详细信息