-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
135 lines (108 loc) · 4.13 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# input .fbs files for schema
FBS_FILES=./cfxdb/*.fbs
FBS_OUTPUT=./cfxdb/gen
#FLATC=${HOME}/scm/3rdparty/flatbuffers/flatc
FLATC=/usr/local/bin/flatc
build_flatc:
cd /tmp && \
wget https://github.com/google/flatbuffers/archive/v23.5.26.tar.gz && \
tar xvf v23.5.26.tar.gz && \
cd flatbuffers-23.5.26 && \
cmake . && \
make && \
sudo cp ./flatc $(FLATC) && \
cd .. && \
rm -rf flatbuffers-23.5.26 && rm v23.5.26.tar.gz
which flatc
flatc --version
clean:
-find . -type d -name "__pycache__" -exec rm -rf {} \;
-rm -rf ./.pytest_cache
-rm -rf ./.mypy_cache/
-rm -rf ./build
-rm -rf ./dist
-rm -rf ./*.egg-info
-rm -rf ./.tox
fix_fx_strings:
find . -type f -exec sed -i 's/Copyright (c) typedef int GmbH. Licensed under MIT./Copyright (c) typedef int GmbH. Licensed under MIT./g' {} \;
find . -type f -exec sed -i 's/Crossbar.io Database/Crossbar.io Database/g' {} \;
install:
pip install -e .
publish: clean
python setup.py sdist bdist_wheel --universal
twine upload dist/*
stats:
@echo
@find ./cfxdb -name "*.fbs" -exec grep -Hi "^table" {} \; | cut -d" " -f1,2 | sort
@echo
@find ./cfxdb -name "*.fbs" -exec grep -Hi "^enum" {} \; | cut -d" " -f1,2 | sort
@echo
@find ./cfxdb -name "*.fbs" -exec grep -Hi "^struct" {} \; | cut -d" " -f1,2 | sort
@echo
@wc -l cfxdb/*.fbs
@echo
@cloc cfxdb
@echo
# list all basic table round-trip tests
list_tests:
find ./cfxdb/tests/test_*.py -exec grep -Hi "def test_.*roundtrip(" {} \;
test:
pytest -v -s ./cfxdb/tests/
# FIXME - create missing tests:
# pytest -v -s ./cfxdb/tests/xbr/test_token_balance.py::test_token_balance_roundtrip
# pytest -v -s ./cfxdb/tests/xbr/test_block.py::test_block_roundtrip
test_xbr_roundtrip:
pytest -v -s ./cfxdb/tests/xbr/test_actor.py::test_actor_roundtrip
pytest -v -s ./cfxdb/tests/xbr/test_api.py::test_api_roundtrip
pytest -v -s ./cfxdb/tests/xbr/test_catalog.py::test_catalog_roundtrip
pytest -v -s ./cfxdb/tests/xbr/test_channel.py::test_channel_roundtrip
pytest -v -s ./cfxdb/tests/xbr/test_channel_balance.py::test_channel_balance_roundtrip
pytest -v -s ./cfxdb/tests/xbr/test_consent.py::test_consent_roundtrip
pytest -v -s ./cfxdb/tests/xbr/test_market.py::test_market_roundtrip
pytest -v -s ./cfxdb/tests/xbr/test_member.py::test_member_roundtrip
pytest -v -s ./cfxdb/tests/xbr/test_offer.py::test_offer_roundtrip
pytest -v -s ./cfxdb/tests/xbr/test_token_approval.py::test_token_approval_roundtrip
pytest -v -s ./cfxdb/tests/xbr/test_token_transfer.py::test_token_transfer_roundtrip
pytest -v -s ./cfxdb/tests/xbr/test_transaction.py::test_transaction_roundtrip
test_single:
pytest -v -s ./cfxdb/tests/test_user.py::test_user_fbs_roundtrip
test_cookiestore:
pytest -v -s ./cfxdb/tests/cookiestore/test_cookie.py
test_realmstore:
pytest -v -s ./cfxdb/tests/realmstore/test_session.py
# auto-format code - WARNING: this my change files, in-place!
# use "pip install yapf==0.29.0"
autoformat:
yapf -ri --style=yapf.ini \
--exclude="cfxdb/gen/*" \
cfxdb
# flatbuffer schema processing / binding code generation
flatc_version:
$(FLATC) --version
clean_fbs:
rm -rf $(FBS_OUTPUT)
mkdir -p $(FBS_OUTPUT)
build_fbs: build_fbs_bfbs build_fbs_python fix_fbs_python
# generate schema type library (.bfbs binary) from schema files
build_fbs_bfbs:
$(FLATC) -o $(FBS_OUTPUT) --binary --schema --bfbs-comments --bfbs-builtins $(FBS_FILES)
# generate python3 bindings from schema files
build_fbs_python:
$(FLATC) -o $(FBS_OUTPUT) --python $(FBS_FILES)
fix_fbs_python:
# those are not generated, but required
find $(FBS_OUTPUT) -type d -exec touch {}/__init__.py \;
# FIXME: wrong import:
# "from oid_t import oid_t" => "from ..oid_t import oid_t"
find $(FBS_OUTPUT) -name "*.py" -exec sed -i'' 's/from oid_t/from ..oid_t/g' {} \;
build_docs:
cd ./docs/ && sphinx-build -b html . _build
test_docs:
cd ./docs/ && sphinx-build -nWT -b spelling -d _build/doctrees . _build/spelling
cd ./docs/ && sphinx-build -nWT -b dummy . _build
run_docs:
twistd --nodaemon web --path=./docs/_build --listen=tcp:8091
clean_docs:
-rm -rf ./docs/_build
fix_copyright:
find . -type f -exec sed -i 's/Copyright (c) Crossbar.io Technologies GmbH/Copyright (c) typedef int GmbH/g' {} \;