forked from crossbario/crossbar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
203 lines (167 loc) · 5.6 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
.PHONY: test docs
all:
@echo "Targets:"
@echo ""
@echo " clean Cleanup"
@echo " test Run unit tests"
@echo " install Local install"
@echo " publish Clean build and publish to PyPI"
@echo " docs Build and test docs"
@echo ""
clean:
rm -rf ./build
rm -rf ./dist
rm -rf ./crossbar.egg-info
rm -rf ./.crossbar
-find . -type d -name _trial_temp -exec rm -rf {} \;
rm -rf ./tests
rm -rf ./.tox
rm -rf ./vers
rm -f .coverage.*
rm -f .coverage
rm -rf ./htmlcov
-rm -rf ./_trial*
-rm -rf ./pip-wheel-metadata
-rm -rf ./docs/_build
-rm -rf ./.mypy_cache
-rm -rf ./.pytest_cache
find . -name "*.db" -exec rm -f {} \;
find . -name "*.pyc" -exec rm -f {} \;
find . -name "*.log" -exec rm -f {} \;
# Learn to love the shell! http://unix.stackexchange.com/a/115869/52500
find . \( -name "*__pycache__" -type d \) -prune -exec rm -rf {} +
# install for development, using pinned dependencies, and including dev-only dependencies
install:
-pip uninstall -y crossbar
pip install --no-cache --upgrade -r requirements-dev.txt
pip install -e .
@python -c "import crossbar; print('*** crossbar-{} ***'.format(crossbar.__version__))"
# upload to our internal deployment system
upload: clean
python setup.py bdist_wheel
aws s3 cp dist/*.whl s3://fabric-deploy/
# publish to PyPI
publish: clean
python setup.py sdist bdist_wheel
twine upload dist/*
# auto-format code - WARNING: this my change files, in-place!
autoformat:
yapf -ri --style=yapf.ini \
--exclude="crossbar/shell/reflection/*" \
--exclude="crossbar/master/database/*" \
--exclude="crossbar/worker/test/examples/syntaxerror.py" \
crossbar
# freeze our dependencies
freeze:
# do everything in a fresh environment
-rm -rf vers
virtualenv vers
vers/bin/pip3 install -U pip setuptools wheel hashin pip-licenses
# install and freeze latest versions of minimum requirements
vers/bin/pip3 install -r requirements-min.txt
vers/bin/pip3 freeze --all | grep -v -e "wheel" -e "pip" -e "distribute" > requirements-pinned.txt
# persist OSS license list of our exact dependencies
vers/bin/pip-licenses --from=classifier -a -o name > LICENSES-OSS
vers/bin/pip-licenses --from=classifier -a -o name --format=rst > docs/soss_licenses_table.rst
sed -i '1s;^;OSS Licenses\n============\n\n;' docs/soss_licenses_table.rst
# hash all dependencies for repeatable builds
vers/bin/pip3 install hashin
-rm requirements.txt
# FIXME: we are using our own unpublished forks of "py-cid" and "py-multihash" for which hashin won't find version data on pypi
-cat requirements-pinned.txt | grep -v "py-cid" | grep -v "py-multihash" | xargs vers/bin/hashin > requirements.txt
-cat requirements-pinned.txt | grep "py-cid" >> requirements.txt
-cat requirements-pinned.txt | grep "py-multihash" >> requirements.txt
wheel:
LMDB_FORCE_CFFI=1 SODIUM_INSTALL=bundled pip wheel --require-hashes --wheel-dir ./wheels -r requirements.txt
# test all syntax check target on the host via tox
test_quick:
tox -e sphinx,flake8,mypy,yapf
# test all targets on the host via tox
test_all:
tox -e sphinx,flake8,mypy,yapf,bandit,py311-pinned-trial,py311-unpinned-trial,py311-abtrunk-trial,py311-examples,pytest,functests-cb
# tox -e functests-cfc
test_automate:
tox -e py311-cli-0
tox -e py311-cli-1,py311-cli-2,py311-cli-3
tox -e py311-api-1
# directly test CLI script normally run for "tox -e py311-cli-0"
test_cli: test_cli0 test_cli1 test_cli2 test_cli3
test_ab_examples:
CROSSBAR_FABRIC_SUPERUSER=${PWD}/test/cfc/.crossbar/default.pub \
./test/test_ab_examples.sh
test_cli0:
CROSSBAR_FABRIC_SUPERUSER=${PWD}/test/cfc/.crossbar/default.pub \
./test/test_cli_0.sh
test_cli1:
CROSSBAR_FABRIC_SUPERUSER=${PWD}/test/cfc/.crossbar/default.pub \
./test/test_cli_1.sh
test_cli2:
CROSSBAR_FABRIC_SUPERUSER=${PWD}/test/cfc/.crossbar/default.pub \
./test/test_cli_2.sh
test_cli3:
CROSSBAR_FABRIC_SUPERUSER=${PWD}/test/cfc/.crossbar/default.pub \
./test/test_cli_3.sh
# test all broken (FIXME) targets
test_fixme:
tox -e py311-automate-1,py311-automate-2,py311-xbrnetwork-1
test_cb_apperrors:
pytest -sv --no-install test/functests/cbtests/test_cb_apperrors.py
test_cb_proxy:
pytest -sv --no-install test/functests/cbtests/test_cb_proxy.py
test_cb_authorize:
pytest -sv crossbar/router/test/test_authorize.py::TestDynamicAuth::test_authextra_wampcryptosign
test_cb_cookie:
trial crossbar.router.test.test_cookiestore
test_wap:
trial crossbar.webservice.test
test_wildcard:
trial crossbar.router.test.test_wildcard
docs:
cd docs && sphinx-build -b html . _build
docs_check:
cd docs && sphinx-build -nWT -b dummy . _build
docs_spelling:
cd docs && sphinx-build -nWT -b spelling -d ./_build/doctrees . ./_build/spelling
docs_run: docs
twistd --nodaemon web --path=docs/_build --listen=tcp:8090
docs_clean:
-rm -rf ./docs/_build
# sudo apt install gource ffmpeg
gource:
gource \
--path . \
--seconds-per-day 0.15 \
--title "crossbar" \
-1280x720 \
--file-idle-time 0 \
--auto-skip-seconds 0.75 \
--multi-sampling \
--stop-at-end \
--highlight-users \
--hide filenames,mouse,progress \
--max-files 0 \
--background-colour 000000 \
--disable-bloom \
--font-size 24 \
--output-ppm-stream - \
--output-framerate 30 \
-o - \
| ffmpeg \
-y \
-r 60 \
-f image2pipe \
-vcodec ppm \
-i - \
-vcodec libx264 \
-preset ultrafast \
-pix_fmt yuv420p \
-crf 1 \
-threads 0 \
-bf 0 \
crossbar.mp4
find_uris:
python find-uris.py
find_registers:
find crossbar -name "*.py" -exec grep -Hi -n2 "@wamp.register" {} \;
fix_copyright:
find . -type f -exec sed -i 's/Copyright (c) Crossbar.io Technologies GmbH/Copyright (c) typedef int GmbH/g' {} \;