2017-01-25 21:14:12 +00:00
|
|
|
.PHONY: default build test doc extensions clean cog
|
2015-04-19 05:50:50 +00:00
|
|
|
|
2015-05-24 18:06:08 +00:00
|
|
|
ifndef PY
|
2015-06-28 19:46:24 +00:00
|
|
|
PY := $(word 2, $(subst ., ,$(shell python --version 2>&1)))
|
2015-05-24 18:06:08 +00:00
|
|
|
endif
|
|
|
|
|
2017-06-12 05:34:45 +00:00
|
|
|
ifeq ($(PY),2)
|
|
|
|
FEATURES := python2
|
|
|
|
endif
|
|
|
|
ifeq ($(PY),3)
|
|
|
|
FEATURES := python3
|
2015-09-19 13:37:29 +00:00
|
|
|
ifdef PEP384
|
|
|
|
export PEP384=1
|
2017-06-12 05:34:45 +00:00
|
|
|
FEATURES := $(FEATURES) pep-384
|
|
|
|
endif
|
2015-09-19 13:37:29 +00:00
|
|
|
endif
|
|
|
|
|
2016-03-05 23:03:17 +00:00
|
|
|
CARGO_FLAGS := --features "$(FEATURES)" --no-default-features
|
2015-05-24 18:06:08 +00:00
|
|
|
|
2017-05-13 05:51:14 +00:00
|
|
|
default: test
|
2015-04-19 05:50:50 +00:00
|
|
|
|
2017-05-17 06:43:39 +00:00
|
|
|
build:
|
2015-09-19 13:37:29 +00:00
|
|
|
cargo build $(CARGO_FLAGS)
|
2015-04-19 05:50:50 +00:00
|
|
|
|
|
|
|
test: build
|
2017-05-31 04:00:22 +00:00
|
|
|
cargo test $(CARGO_FLAGS)
|
2017-07-26 04:37:36 +00:00
|
|
|
pip install setuptools-rust pytest pytest-benchmark
|
|
|
|
cd examples/word-count && python setup.py install && pytest -v tests
|
2017-05-14 20:14:02 +00:00
|
|
|
|
2017-06-15 16:11:19 +00:00
|
|
|
clippy:
|
|
|
|
if $$CLIPPY; then cargo clippy $(CARGO_FLAGS); fi
|
|
|
|
|
|
|
|
|
2017-05-14 20:14:02 +00:00
|
|
|
#ifeq ($(NIGHTLY),1)
|
2016-03-06 00:08:40 +00:00
|
|
|
# ast-json output is only supported on nightly
|
2017-05-14 20:14:02 +00:00
|
|
|
# python$(PY) tests/check_symbols.py
|
|
|
|
#endif
|
2015-04-19 05:50:50 +00:00
|
|
|
|
|
|
|
doc: build
|
2015-09-19 13:37:29 +00:00
|
|
|
cargo doc --no-deps $(CARGO_FLAGS)
|
2015-04-19 05:50:50 +00:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -r target
|
|
|
|
|
|
|
|
gh-pages:
|
2017-05-13 06:01:54 +00:00
|
|
|
git clone --branch gh-pages git@github.com:PyO3/PyO3.git gh-pages
|
2015-04-19 05:50:50 +00:00
|
|
|
|
|
|
|
.PHONY: gh-pages-doc
|
|
|
|
gh-pages-doc: doc | gh-pages
|
|
|
|
cd gh-pages && git pull
|
|
|
|
rm -r gh-pages/doc
|
|
|
|
cp -r target/doc gh-pages/
|
|
|
|
rm gh-pages/doc/.lock
|
|
|
|
cd gh-pages && git add .
|
|
|
|
cd gh-pages && git commit -m "Update documentation"
|
|
|
|
|
|
|
|
publish: default gh-pages-doc
|
|
|
|
cargo publish
|
|
|
|
cd gh-pages && git push
|