-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathMakefile
52 lines (40 loc) · 1.4 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
.PHONY: build check install doc dist sources srpm rpm pypi clean
PYTHON ?= python3
NAME := psh
RPM_NAME := python-$(NAME)
VERSION := $(shell $(PYTHON) setup.py --version)
TEST_ENV_PATH := test-env
CHECK_PYTHON_VERSIONS := 2 3
build:
$(PYTHON) setup.py build
check:
@mkdir -p "$(TEST_ENV_PATH)"
@set -e; for version in $(CHECK_PYTHON_VERSIONS); do \
echo; echo "Testing $(NAME) with python$$version..."; echo; \
env_path="$(TEST_ENV_PATH)/python$$version"; \
if [ ! -e "$$env_path" ]; then \
virtualenv --python python$$version --distribute "$$env_path" && \
"$$env_path/bin/pip" install psys pytest || { rm -rf "$$env_path"; false; }; \
fi; \
"$$env_path/bin/python" setup.py test; \
done
install:
$(PYTHON) setup.py install --skip-build $(INSTALL_FLAGS)
doc:
$(MAKE) -C doc html SPHINXOPTS="-D version=$(VERSION)"
dist: clean
$(PYTHON) setup.py sdist
cp dist/$(NAME)-*.tar.gz .
sources:
@git archive --format=tar --prefix="$(NAME)-$(VERSION)/" \
$(shell git rev-parse --verify HEAD) | gzip > $(NAME)-$(VERSION).tar.gz
srpm: dist
rpmbuild -bs --define "_sourcedir $(CURDIR)" $(RPM_NAME).spec
rpm: dist
rpmbuild -ba --define "_sourcedir $(CURDIR)" $(RPM_NAME).spec
pypi: dist
$(PYTHON) -m twine upload dist/*
clean:
@$(MAKE) -C doc clean
find . -depth -type d -name __pycache__ -exec rm -rf {} \;
rm -rf build dist $(NAME)-*.tar.gz $(NAME).egg-info *.egg $(TEST_ENV_PATH)