-
Notifications
You must be signed in to change notification settings - Fork 75
Expand file tree
/
Copy pathMakefile
More file actions
63 lines (53 loc) · 2.16 KB
/
Makefile
File metadata and controls
63 lines (53 loc) · 2.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
ROOTDIR=../
VENV=$(ROOTDIR)venv/bin/
.PHONY: pre-commit
pre-commit: lint
.PHONY: fmt
fmt:
$(VENV)black .
.PHONY: develop
develop:
$(VENV)python setup.py develop
# --import-mode makes pytest import from globally installed package by default instead of local replicate/ module.
# This assumes you've run `make develop` before running tests
# https://docs.pytest.org/en/stable/pythonpath.html#pythonpath
.PHONY: test
test: lint
$(VENV)pytest --import-mode=importlib -m "not external"
.PHONY: test-external
test-external: lint
$(VENV)pytest --import-mode=importlib
.PHONY: lint
lint:
$(VENV)mypy .
$(VENV)black --check .
.PHONY: clean
clean:
rm -rf build dist replicate/bin
# Build packages for the various platforms.
# setup.py handles converting these platform names into Go platforms.
#
# One trick worth noting with the build system: we're building "pure" Python
# libraries, that theoretically aren't tied to any Python runtime or platform.
# But, handily, wheel lets us override the platform with --plat-name even when it is a pure library:
# https://github.com/pypa/wheel/blob/730e3ae7427682435af9572126d2722adf7c438c/src/wheel/bdist_wheel.py#L237-L240
# I'm not sure we really should be doing this, because setting platform seems to be designed
# for non-pure modules, but what the heck, this seems to work?
# Anyway -- I'm writing this down here because if this stops working at some point in
# the future it's because wheel changed their logic around pure modules.
#
# For macosx, the version number indicates the _minimum_ version, so we just use an arbitrarily old one
# (the same one that numpy uses *shrug*)
# https://docs.python.org/3/distutils/apiref.html#distutils.util.get_platform
.PHONY: build
build: clean
$(VENV)pip install wheel
$(VENV)python setup.py bdist_wheel --plat-name manylinux1_x86_64
$(VENV)python setup.py bdist_wheel --plat-name macosx_10_9_x86_64
.PHONY: targets
targets:
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$'
.PHONY: vendor
vendor:
$(VENV)pip install vendoring
$(VENV)vendoring sync -v .