forked from axiak/pyre2
-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathMakefile
More file actions
45 lines (35 loc) · 1.16 KB
/
Copy pathMakefile
File metadata and controls
45 lines (35 loc) · 1.16 KB
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
PYTHON ?= python3
PYTHON_TAG := $(shell $(PYTHON) -c "import sys; print(sys.implementation.cache_tag)")
WHEEL_DIR := build/make/$(PYTHON_TAG)
WHEEL_STAMP := $(WHEEL_DIR)/.built
BUILD_SOURCES := \
pyproject.toml setup.py CMakeLists.txt \
$(wildcard src/*.pyx src/*.pxi src/*.h) \
src/CMakeLists.txt
.PHONY: all build install test lint clean distclean
all: build
# Build a wheel through pip's PEP 517 interface. Build dependencies declared in
# pyproject.toml are installed in an isolated environment automatically.
build: $(WHEEL_STAMP)
$(WHEEL_STAMP): $(BUILD_SOURCES)
rm -rf "$(WHEEL_DIR)"
mkdir -p "$(WHEEL_DIR)" dist
$(PYTHON) -m pip wheel --no-deps --wheel-dir "$(WHEEL_DIR)" .
cp "$(WHEEL_DIR)"/*.whl dist/
touch "$@"
# Compile and install pyre2 into the active Python environment.
install:
$(PYTHON) -m pip install .
test: $(WHEEL_STAMP)
set -- "$(WHEEL_DIR)"/*.whl; \
test "$$#" -eq 1; \
$(PYTHON) -m pip install "$${1}[test]"
$(PYTHON) -m pytest
lint:
cython-lint src/
ruff check
clean:
rm -rf build pyre2.egg-info UNKNOWN.egg-info
rm -f re2*.so src/re2*.so src/re2.cpp src/*.html
distclean: clean
rm -rf .tox dist .pytest_cache tests/.pytest_cache