spaCy/Makefile

56 lines
1.4 KiB
Makefile
Raw Normal View History

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