Skip to content

Commit

Permalink
Tune C source generation (aio-libs#5164)
Browse files Browse the repository at this point in the history
  • Loading branch information
asvetlov committed Oct 28, 2020
1 parent 708825a commit 3c4ba8f
Show file tree
Hide file tree
Showing 11 changed files with 92 additions and 10,158 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@
.noseids
.tox
.vimrc
aiohttp/_find_header.c
aiohttp/_frozenlist.c
aiohttp/_frozenlist.html
aiohttp/_headers.pxi
aiohttp/_helpers.c
aiohttp/_helpers.html
aiohttp/_websocket.c
Expand Down
19 changes: 14 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Some simple testing tasks (sorry, UNIX only).

PYXS = $(wildcard aiohttp/*.pyx)
PYXS = $(wildcard aiohttp/*.{pyx,pyi,pxd})
CS = $(wildcard aiohttp/*.c)
PYS = $(wildcard aiohttp/*.py)
REQS = $(wildcard requirements/*.txt)
SRC = aiohttp examples tests setup.py

.PHONY: all
Expand All @@ -10,13 +13,18 @@ all: test
pip install -r requirements/cython.txt
@touch .install-cython

aiohttp/%.c: aiohttp/%.pyx
aiohttp/_find_header.c: aiohttp/hdrs.py
./tools/gen.py

# _find_headers generator creates _headers.pyi as well
aiohttp/%.c: aiohttp/%.pyx aiohttp/_find_header.c
cython -3 -o $@ $< -I aiohttp


.PHONY: cythonize
cythonize: .install-cython $(PYXS:.pyx=.c)

.install-deps: .install-cython $(PYXS:.pyx=.c) $(wildcard requirements/*.txt)
.install-deps: .install-cython $(PYXS) $(REQS)
pip install -r requirements/dev.txt
@touch .install-deps

Expand All @@ -25,7 +33,7 @@ lint: fmt mypy

.PHONY: fmt format
fmt format: check_changes
python3 -m pre_commit run --all-files --show-diff-on-failure
python -m pre_commit run --all-files --show-diff-on-failure

.PHONY: mypy
mypy:
Expand All @@ -36,7 +44,8 @@ check_changes:
./tools/check_changes.py


.develop: .install-deps $(wildcard aiohttp/*)
.develop: .install-deps $(PYS) $(PYXS) $(CS)
pip install -e .
@touch .develop

.PHONY: test
Expand Down
Loading

0 comments on commit 3c4ba8f

Please sign in to comment.