2018-06-02 15:10:15 +00:00
|
|
|
SHELL := /bin/bash
|
2020-08-24 14:32:21 +00:00
|
|
|
|
|
|
|
ifndef SPACY_EXTRAS
|
2020-09-10 07:33:59 +00:00
|
|
|
override SPACY_EXTRAS = spacy-lookups-data==0.4.0.dev0 jieba pkuseg==0.0.25 sudachipy sudachidict_core
|
2020-08-24 14:32:21 +00:00
|
|
|
endif
|
2020-02-26 19:59:10 +00:00
|
|
|
|
2020-08-30 14:16:30 +00:00
|
|
|
ifndef PYVER
|
|
|
|
override PYVER = 3.6
|
|
|
|
endif
|
|
|
|
|
|
|
|
VENV := ./env$(PYVER)
|
|
|
|
|
2020-03-04 18:28:16 +00:00
|
|
|
version := $(shell "bin/get-version.sh")
|
2020-08-24 12:41:56 +00:00
|
|
|
package := $(shell "bin/get-package.sh")
|
|
|
|
|
2020-08-24 15:09:05 +00:00
|
|
|
ifndef SPACY_BIN
|
|
|
|
override SPACY_BIN = $(package)-$(version).pex
|
|
|
|
endif
|
2020-08-24 12:48:32 +00:00
|
|
|
|
2020-08-30 18:00:49 +00:00
|
|
|
ifndef WHEELHOUSE
|
|
|
|
override WHEELHOUSE = "./wheelhouse"
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dist/$(SPACY_BIN) : $(WHEELHOUSE)/spacy-$(PYVER)-$(version).stamp
|
2020-08-31 23:22:54 +00:00
|
|
|
$(VENV)/bin/pex \
|
2020-08-30 18:00:49 +00:00
|
|
|
-f $(WHEELHOUSE) \
|
2020-08-24 12:41:56 +00:00
|
|
|
--no-index \
|
|
|
|
--disable-cache \
|
|
|
|
-m spacy \
|
|
|
|
-o $@ \
|
|
|
|
$(package)==$(version) \
|
|
|
|
$(SPACY_EXTRAS)
|
2020-03-04 18:28:16 +00:00
|
|
|
chmod a+rx $@
|
2020-05-25 14:39:22 +00:00
|
|
|
cp $@ dist/spacy.pex
|
2019-08-25 12:54:19 +00:00
|
|
|
|
2020-08-30 18:14:52 +00:00
|
|
|
dist/pytest.pex : $(WHEELHOUSE)/pytest-*.whl
|
2020-08-30 18:00:49 +00:00
|
|
|
$(VENV)/bin/pex -f $(WHEELHOUSE) --no-index --disable-cache -m pytest -o $@ pytest pytest-timeout mock
|
2020-03-04 18:28:16 +00:00
|
|
|
chmod a+rx $@
|
2019-08-25 12:54:19 +00:00
|
|
|
|
2020-08-30 18:00:49 +00:00
|
|
|
$(WHEELHOUSE)/spacy-$(PYVER)-$(version).stamp : $(VENV)/bin/pex setup.py spacy/*.py* spacy/*/*.py*
|
2020-08-31 23:22:54 +00:00
|
|
|
$(VENV)/bin/pip wheel . -w $(WHEELHOUSE)
|
|
|
|
$(VENV)/bin/pip wheel $(SPACY_EXTRAS) -w $(WHEELHOUSE)
|
2020-08-24 12:41:56 +00:00
|
|
|
|
2020-03-04 18:28:16 +00:00
|
|
|
touch $@
|
2020-02-26 19:59:10 +00:00
|
|
|
|
2020-08-30 18:00:49 +00:00
|
|
|
$(WHEELHOUSE)/pytest-%.whl : $(VENV)/bin/pex
|
|
|
|
$(VENV)/bin/pip wheel pytest pytest-timeout mock -w $(WHEELHOUSE)
|
2020-02-26 19:59:10 +00:00
|
|
|
|
2020-03-04 18:28:16 +00:00
|
|
|
$(VENV)/bin/pex :
|
2020-02-26 19:59:10 +00:00
|
|
|
python$(PYVER) -m venv $(VENV)
|
2020-03-08 12:24:19 +00:00
|
|
|
$(VENV)/bin/pip install -U pip setuptools pex wheel
|
2020-08-30 15:11:24 +00:00
|
|
|
$(VENV)/bin/pip install numpy
|
2020-02-26 19:59:10 +00:00
|
|
|
|
|
|
|
.PHONY : clean test
|
2018-06-24 21:39:34 +00:00
|
|
|
|
2020-02-26 19:59:10 +00:00
|
|
|
test : dist/spacy-$(version).pex dist/pytest.pex
|
2020-03-04 18:28:16 +00:00
|
|
|
( . $(VENV)/bin/activate ; \
|
|
|
|
PEX_PATH=dist/spacy-$(version).pex ./dist/pytest.pex --pyargs spacy -x ; )
|
2018-06-24 21:39:34 +00:00
|
|
|
|
|
|
|
clean : setup.py
|
|
|
|
rm -rf dist/*
|
2020-08-30 18:00:49 +00:00
|
|
|
rm -rf $(WHEELHOUSE)/*
|
2020-03-04 18:28:16 +00:00
|
|
|
rm -rf $(VENV)
|
2018-06-24 21:39:34 +00:00
|
|
|
python setup.py clean --all
|