mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 01:16:28 +03:00
streamline ci/build systems
This commit is contained in:
parent
e00f87c793
commit
762bcc4b1f
|
@ -43,30 +43,20 @@ install:
|
|||
- "python --version"
|
||||
- "python -c \"import struct; print(struct.calcsize('P') * 8)\""
|
||||
|
||||
# Upgrade to the latest version of pip to avoid it displaying warnings
|
||||
# about it being out of date.
|
||||
- "pip install --disable-pip-version-check --user --upgrade pip"
|
||||
|
||||
# Install the build dependencies of the project. If some dependencies contain
|
||||
# compiled extensions and are not provided as pre-built wheel packages,
|
||||
# pip will build them from source using the MSVC compiler matching the
|
||||
# target Python version and architecture
|
||||
- "pip install --upgrade setuptools"
|
||||
- "%CMD_IN_ENV% pip install cython fabric fabtools"
|
||||
- "%CMD_IN_ENV% pip install -r requirements.txt"
|
||||
- "%CMD_IN_ENV% python build.py prepare"
|
||||
|
||||
build_script:
|
||||
# Build the compiled extension
|
||||
- "%CMD_IN_ENV% python setup.py build_ext --inplace"
|
||||
- ps: appveyor\download.ps1
|
||||
- "tar -xzf corpora/en/wordnet.tar.gz"
|
||||
- "%CMD_IN_ENV% python bin/init_model.py en lang_data/ corpora/ spacy/en/data"
|
||||
- "%CMD_IN_ENV% python build.py pip"
|
||||
|
||||
|
||||
test_script:
|
||||
# Run the project tests
|
||||
- "pip install pytest"
|
||||
- "%CMD_IN_ENV% py.test spacy/ -x"
|
||||
- "%CMD_IN_ENV% python build.py test"
|
||||
|
||||
after_test:
|
||||
# If tests are successful, create binary packages for the project.
|
||||
|
|
34
.travis.yml
34
.travis.yml
|
@ -17,28 +17,16 @@ env:
|
|||
- PIP_DATE=2015-10-01 PIP=0 INSTALL=0 DEVELOP=1
|
||||
|
||||
install:
|
||||
- pip install -U pip
|
||||
- python pip-date.py $PIP_DATE pip setuptools wheel six
|
||||
- pip install -r requirements.txt
|
||||
|
||||
- if [[ "$PIP" == "1" ]]; then
|
||||
python setup.py sdist;
|
||||
pip install dist/*;
|
||||
fi
|
||||
|
||||
- if [[ "$INSTALL" == "1" ]]; then
|
||||
python setup.py install;
|
||||
fi
|
||||
|
||||
- if [[ "$DEVELOP" == "1" ]]; then
|
||||
python setup.py develop;
|
||||
pip install -e .;
|
||||
fi
|
||||
|
||||
- pip install pytest
|
||||
- pip list
|
||||
- python build.py prepare $PIP_DATE
|
||||
|
||||
script:
|
||||
- mkdir tmp; cd tmp
|
||||
- python -m spacy.en.download
|
||||
- python -m pytest ../spacy/ -x --models --vectors --slow
|
||||
- if [[ "$PIP" == "1" ]]; then
|
||||
python build.py pip;
|
||||
fi
|
||||
- if [[ "$INSTALL" == "1" ]]; then
|
||||
python build.py setup-install;
|
||||
fi
|
||||
- if [[ "$DEVELOP" == "1" ]]; then
|
||||
python build.py setup-develop;
|
||||
fi
|
||||
- python build.py test
|
||||
|
|
57
build.py
57
build.py
|
@ -19,41 +19,58 @@ if len(sys.argv) < 2:
|
|||
|
||||
|
||||
install_mode = sys.argv[1]
|
||||
pip_date = len(sys.argv) > 2 and sys.argv[2]
|
||||
|
||||
|
||||
x('pip install -U pip')
|
||||
if pip_date:
|
||||
x('python pip-date.py %s pip setuptools wheel six' % pip_date)
|
||||
x('pip install -r requirements.txt')
|
||||
if install_mode == 'prepare':
|
||||
x('python pip-clear.py')
|
||||
x('pip install --disable-pip-version-check -U pip setuptools')
|
||||
|
||||
if install_mode == 'pip':
|
||||
for filename in os.listdir('dist'):
|
||||
os.unlink(os.path.join('dist', filename))
|
||||
pip_date = len(sys.argv) > 2 and sys.argv[2]
|
||||
if pip_date:
|
||||
x('python pip-date.py %s pip setuptools wheel six' % pip_date)
|
||||
|
||||
x('pip install -r requirements.txt')
|
||||
x('pip list')
|
||||
|
||||
|
||||
elif install_mode == 'pip':
|
||||
if os.path.exists('dist'):
|
||||
shutil.rmtree('dist')
|
||||
x('python setup.py sdist')
|
||||
x('python pip-clear.py')
|
||||
|
||||
filenames = os.listdir('dist')
|
||||
assert len(filenames) == 1
|
||||
x('pip list')
|
||||
x('pip install dist/%s' % filenames[0])
|
||||
|
||||
|
||||
elif install_mode == 'setup-install':
|
||||
x('python setup.py install')
|
||||
|
||||
|
||||
elif install_mode == 'setup-develop':
|
||||
x('python setup.py develop')
|
||||
x('python pip-clear.py')
|
||||
|
||||
x('pip list')
|
||||
x('pip install -e .')
|
||||
|
||||
x('pip install pytest')
|
||||
x('pip list')
|
||||
|
||||
if os.path.exists('tmp'):
|
||||
shutil.rmtree('tmp')
|
||||
os.mkdir('tmp')
|
||||
elif install_mode == 'test':
|
||||
x('pip install pytest')
|
||||
x('pip list')
|
||||
|
||||
try:
|
||||
old = os.getcwd()
|
||||
os.chdir('tmp')
|
||||
if os.path.exists('tmp'):
|
||||
shutil.rmtree('tmp')
|
||||
os.mkdir('tmp')
|
||||
|
||||
x('python -m spacy.en.download')
|
||||
x('python -m pytest ../spacy/ --models --vectors --slow')
|
||||
try:
|
||||
old = os.getcwd()
|
||||
os.chdir('tmp')
|
||||
|
||||
finally:
|
||||
os.chdir(old)
|
||||
x('python -m spacy.en.download')
|
||||
x('python -m pytest ../spacy/ --models --vectors --slow')
|
||||
|
||||
finally:
|
||||
os.chdir(old)
|
||||
|
|
28
pip-clear.py
Executable file
28
pip-clear.py
Executable file
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env python
|
||||
from __future__ import print_function
|
||||
|
||||
from pip.commands.uninstall import UninstallCommand
|
||||
from pip import get_installed_distributions
|
||||
|
||||
|
||||
packages = []
|
||||
for package in get_installed_distributions():
|
||||
if package.location.endswith('dist-packages'):
|
||||
continue
|
||||
elif package.project_name in ('pip', 'setuptools'):
|
||||
continue
|
||||
packages.append(package.project_name)
|
||||
|
||||
|
||||
if packages:
|
||||
pip = UninstallCommand()
|
||||
options, args = pip.parse_args(packages)
|
||||
options.yes = True
|
||||
|
||||
try:
|
||||
pip.run(options, args)
|
||||
except OSError as e:
|
||||
if e.errno != 13:
|
||||
raise e
|
||||
print("You lack permissions to uninstall this package. Perhaps run with sudo? Exiting.")
|
||||
exit(13)
|
4
venv.ps1
4
venv.ps1
|
@ -10,5 +10,7 @@ if(!(Test-Path -Path ".build"))
|
|||
}
|
||||
.build\Scripts\activate.ps1
|
||||
|
||||
python build.py $install_mode $pip_date
|
||||
python build.py prepare $pip_date
|
||||
python build.py $install_mode
|
||||
python build.py test
|
||||
exit $LASTEXITCODE
|
||||
|
|
Loading…
Reference in New Issue
Block a user