2019-11-21 11:47:54 +08:00
|
|
|
FILES_TO_LINT = libp2p tests tests_interop examples setup.py
|
2019-10-25 17:51:38 +08:00
|
|
|
PB = libp2p/crypto/pb/crypto.proto \
|
|
|
|
libp2p/pubsub/pb/rpc.proto \
|
|
|
|
libp2p/security/insecure/pb/plaintext.proto \
|
|
|
|
libp2p/security/secio/pb/spipe.proto \
|
|
|
|
libp2p/identity/identify/pb/identify.proto
|
2019-08-16 17:08:22 +08:00
|
|
|
PY = $(PB:.proto=_pb2.py)
|
|
|
|
PYI = $(PB:.proto=_pb2.pyi)
|
|
|
|
|
|
|
|
# Set default to `protobufs`, otherwise `format` is called when typing only `make`
|
|
|
|
all: protobufs
|
2019-08-03 18:02:27 +08:00
|
|
|
|
|
|
|
format:
|
|
|
|
black $(FILES_TO_LINT)
|
|
|
|
isort --recursive $(FILES_TO_LINT)
|
2019-10-25 02:10:36 +08:00
|
|
|
docformatter -ir --pre-summary-newline $(FILES_TO_LINT)
|
2019-08-03 18:02:27 +08:00
|
|
|
|
2019-08-03 01:52:53 +08:00
|
|
|
lintroll:
|
2019-08-14 05:32:54 +08:00
|
|
|
mypy -p libp2p -p examples --config-file mypy.ini
|
2019-08-03 18:02:27 +08:00
|
|
|
black --check $(FILES_TO_LINT)
|
|
|
|
isort --recursive --check-only $(FILES_TO_LINT)
|
2019-10-26 18:45:26 +08:00
|
|
|
docformatter --pre-summary-newline --check --recursive $(FILES_TO_LINT)
|
2019-08-04 00:11:49 +08:00
|
|
|
flake8 $(FILES_TO_LINT)
|
2019-08-03 03:20:48 +08:00
|
|
|
|
2019-08-16 17:08:22 +08:00
|
|
|
protobufs: $(PY)
|
|
|
|
|
|
|
|
%_pb2.py: %.proto
|
|
|
|
protoc --python_out=. --mypy_out=. $<
|
|
|
|
|
2019-11-15 04:47:21 +08:00
|
|
|
clean-proto:
|
|
|
|
rm -f $(PY) $(PYI)
|
2019-08-16 17:08:22 +08:00
|
|
|
|
|
|
|
clean:
|
2019-11-15 04:47:21 +08:00
|
|
|
find . -name '__pycache__' -exec rm -rf {} +
|
|
|
|
rm -fr build/
|
|
|
|
rm -fr dist/
|
|
|
|
rm -fr *.egg-info
|
|
|
|
|
|
|
|
package: clean
|
|
|
|
python setup.py sdist bdist_wheel
|
|
|
|
python scripts/release/test_package.py
|