Improve Makefile (#5067)

* Improve pex making

* Update gitignore
This commit is contained in:
Matthew Honnibal 2020-02-26 20:59:10 +01:00 committed by GitHub
parent 1c212215cd
commit b4e0d2bf50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 17 deletions

2
.gitignore vendored
View File

@ -40,6 +40,7 @@ __pycache__/
.~env/ .~env/
.venv .venv
venv/ venv/
env3.*/
.dev .dev
.denv .denv
.pypyenv .pypyenv
@ -56,6 +57,7 @@ lib64/
parts/ parts/
sdist/ sdist/
var/ var/
wheelhouse/
*.egg-info/ *.egg-info/
pip-wheel-metadata/ pip-wheel-metadata/
Pipfile.lock Pipfile.lock

View File

@ -1,28 +1,36 @@
SHELL := /bin/bash SHELL := /bin/bash
sha = $(shell "git" "rev-parse" "--short" "HEAD") WHEELHOUSE := ./wheelhouse
PYVER := 3.6
VENV := ./env$(PYVER)
version = $(shell "bin/get-version.sh") version = $(shell "bin/get-version.sh")
wheel = spacy-$(version)-cp36-cp36m-linux_x86_64.whl
dist/spacy.pex : dist/spacy-$(sha).pex dist/spacy-$(version).pex : wheelhouse/spacy-$(version)-*.whl
cp dist/spacy-$(sha).pex dist/spacy.pex pex -f ./wheelhouse --no-index --disable-cache -m spacy -o dist/spacy-$(version).pex spacy==$(version) jsonschema
chmod a+rx dist/spacy.pex chmod a+rx dist/spacy-$(version).pex
dist/spacy-$(sha).pex : dist/$(wheel) dist/pytest.pex : wheelhouse/pytest-*.whl
env3.6/bin/python -m pip install pex==1.5.3 $(VENV)/bin/pex -f ./wheelhouse --no-index --disable-cache -m pytest -o dist/pytest.pex pytest pytest-timeout mock
env3.6/bin/pex pytest dist/$(wheel) spacy_lookups_data -e spacy -o dist/spacy-$(sha).pex chmod a+rx dist/pytest.pex
dist/$(wheel) : setup.py spacy/*.py* spacy/*/*.py* wheelhouse/spacy-$(version)-%.whl : $(VENV)/bin/pex setup.py spacy/*.py* spacy/*/*.py*
python3.6 -m venv env3.6 $(VENV)/bin/pip wheel . -w ./wheelhouse
source env3.6/bin/activate $(VENV)/bin/pip wheel jsonschema spacy_lookups_data -w ./wheelhouse
env3.6/bin/pip install wheel
env3.6/bin/pip install -r requirements.txt --no-cache-dir
env3.6/bin/python setup.py build_ext --inplace
env3.6/bin/python setup.py sdist
env3.6/bin/python setup.py bdist_wheel
.PHONY : clean wheelhouse/pytest-%.whl : $(VENV)/bin/pex
$(VENV)/bin/pip wheel pytest pytest-timeout mock -w ./wheelhouse
$(VENV) :
python$(PYVER) -m venv $(VENV)
$(VENV)/bin/python -m pip install pex wheel
.PHONY : clean test
test : dist/spacy-$(version).pex dist/pytest.pex
PEX_PATH=dist/spacy-$(version).pex ./dist/pytest.pex --pyargs spacy -x
clean : setup.py clean : setup.py
source env3.6/bin/activate source env3.6/bin/activate
rm -rf dist/* rm -rf dist/*
rm -rf ./wheelhouse
python setup.py clean --all python setup.py clean --all