This repository has been archived by the owner on Sep 16, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathMakefile
157 lines (135 loc) · 4.29 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
MINIMUM_PYTHON_VERSION=3.8
all: pypi
.PHONY: test
test:
python3 -m tests
.PHONY: mypy
mypy:
mypy --python-version=$(MINIMUM_PYTHON_VERSION) --config-file mypy.conf typedload
mypy --python-version=$(MINIMUM_PYTHON_VERSION) example.py
pyproject.toml: docs/CHANGELOG.md
./gensetup.py --$@
setup.py: docs/CHANGELOG.md README.md
./gensetup.py --$@
chmod u+x setup.py
pypi: pyproject.toml setup.py typedload
mkdir -p dist pypi
./setup.py sdist
./setup.py bdist_wheel
mv dist/typedload-`head -1 CHANGELOG`.tar.gz pypi
mv dist/*whl pypi
rmdir dist
gpg --detach-sign -a pypi/typedload-`head -1 CHANGELOG`.tar.gz
gpg --detach-sign -a pypi/typedload-`head -1 CHANGELOG`-py3-none-any.whl
# Debian needs setup and pyproject to be kept since they are in the
# dist file. However I want to clean them or they will become outdated
# and not regenerated
.PHONY: debian_clean
debian_clean:
$(RM) -r pypi
$(RM) -r .mypy_cache
$(RM) -r typedload.egg-info/
$(RM) -r .pybuild
$(RM) MANIFEST
$(RM) -r `find . -name __pycache__`
$(RM) typedload_`head -1 CHANGELOG`.orig.tar.gz
$(RM) typedload_`head -1 CHANGELOG`.orig.tar.gz.asc
$(RM) -r deb-pkg
$(RM) -r html
$(RM) -r perftest.output
$(RM) docs/*_docgen.md
.PHONY: clean
clean: debian_clean
$(RM) setup.py
$(RM) pyproject.toml
.PHONY: dist
dist: clean setup.py pyproject.toml
cd ..; tar -czvvf typedload.tar.gz \
typedload/setup.py \
typedload/Makefile \
typedload/tests \
typedload/docs \
typedload/docgen \
typedload/mkdocs.yml \
typedload/LICENSE \
typedload/CONTRIBUTING.md \
typedload/CHANGELOG \
typedload/README.md \
typedload/example.py \
typedload/mypy.conf \
typedload/pyproject.toml \
typedload/typedload
mv ../typedload.tar.gz typedload_`./setup.py --version`.orig.tar.gz
gpg --detach-sign -a *.orig.tar.gz
.PHONY: upload
upload: pypi
twine upload --username __token__ --password `cat .token` pypi/*
deb-pkg: dist
mv typedload_`./setup.py --version`.orig.tar.gz* /tmp
cd /tmp; tar -xf typedload_*.orig.tar.gz
cp -r debian /tmp/typedload/
cd /tmp/typedload/; dpkg-buildpackage --changes-option=-S
mkdir deb-pkg
mv /tmp/typedload_* /tmp/python3-typedload*.deb deb-pkg
$(RM) -r /tmp/typedload
lintian --pedantic -E --color auto -i -I deb-pkg/*.changes deb-pkg/*.deb
docs/typedload_docgen.md: typedload/__init__.py
./docgen $@
docs/typedload.dataloader_docgen.md: typedload/dataloader.py
./docgen $@
docs/typedload.datadumper_docgen.md: typedload/datadumper.py
./docgen $@
docs/typedload.exceptions_docgen.md: typedload/exceptions.py
./docgen $@
docs/typedload.typechecks_docgen.md: typedload/typechecks.py
./docgen $@
html: \
docs/*.svg \
docs/CHANGELOG.md \
docs/CODE_OF_CONDUCT.md \
docs/comparisons.md \
docs/CONTRIBUTING.md \
docs/deferred_evaluation.md \
docs/docs \
docs/docs/gpl3logo.png \
docs/errors.md \
docs/examples.md \
docs/gpl3logo.png \
docs/origin_story.md \
docs/performance.md \
docs/README.md \
docs/SECURITY.md \
docs/supported_types.md \
docs/typedload.datadumper_docgen.md \
docs/typedload.dataloader_docgen.md \
docs/typedload_docgen.md \
docs/typedload.exceptions_docgen.md \
docs/typedload.typechecks_docgen.md \
mkdocs.yml
mkdocs build
# Download cloudflare crap
mkdir -p html/cdn
cd html/cdn; wget --continue `cat ../*html | grep cloudflare | grep min.css | sort | uniq | cut -d\" -f4`
cd html/cdn; wget --continue `cat ../*html | grep cloudflare | grep min.js | sort | uniq | cut -d\" -f2`
# Fix html pages
for page in html/*.html; do \
sed -i 's,https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/styles/github.min.css,cdn/github.min.css,g' $${page}; \
sed -i 's,https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/highlight.min.js,cdn/highlight.min.js,g' $${page}; \
echo "<!-- Trackers stripped from mkdocs theme by me -_-' -->" >> $${page}; \
done
.PHONY: publish_html
publish_html: html
git checkout gh-pages
rm -rf cdn css docs fonts img js search
mv html/* .
git add cdn css docs fonts img js search
git add `git status --porcelain | grep '^ M' | cut -d\ -f3`
git commit -m "Deployed manually to workaround MkDocs"
git push
git checkout -
perftest.output/perf.p:
@echo export MOREVERSIONS=1 to compare more versions
perftest/performance.py
.PHONY: gnuplot
gnuplot: perftest.output/perf.p
cd "perftest.output"; gnuplot -persist -c perf.p