forked from teemtee/fmf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
74 lines (62 loc) · 1.67 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
# Prepare variables
TMP = $(CURDIR)/tmp
VERSION = $(shell grep ^Version fmf.spec | sed 's/.* //')
PACKAGE = fmf-$(VERSION)
FILES = LICENSE README.rst \
Makefile fmf.spec setup.py \
examples fmf bin tests
# Define special targets
all: docs packages
.PHONY: docs hooks
# Temporary directory
tmp:
mkdir $(TMP)
# Run the test suite, optionally with coverage
test: tmp
python2 -m pytest tests
python3 -m pytest tests
smoke: tmp
python2 -m pytest tests/test_smoke.py
python3 -m pytest tests/test_smoke.py
coverage: tmp
coverage run --source=fmf,bin -m py.test tests
coverage report
coverage annotate
# Build documentation, prepare man page
docs: man
cd docs && make html
man: source
cp docs/header.txt $(TMP)/man.rst
tail -n+7 README.rst >> $(TMP)/man.rst
rst2man $(TMP)/man.rst > $(TMP)/$(PACKAGE)/fmf.1
# RPM packaging
source: clean
mkdir -p $(TMP)/SOURCES
mkdir -p $(TMP)/$(PACKAGE)
cp -a $(FILES) $(TMP)/$(PACKAGE)
tarball: source man
cd $(TMP) && tar cfz SOURCES/$(PACKAGE).tar.gz $(PACKAGE)
rpm: tarball
rpmbuild --define '_topdir $(TMP)' -bb fmf.spec
srpm: tarball
rpmbuild --define '_topdir $(TMP)' -bs fmf.spec
packages: rpm srpm
# Python packaging
wheel:
python setup.py bdist_wheel
python3 setup.py bdist_wheel
upload:
twine upload dist/*.whl
# Git hooks, vim tags and cleanup
hooks:
ln -snf ../../hooks/pre-commit .git/hooks
ln -snf ../../hooks/commit-msg .git/hooks
tags:
find fmf -name '*.py' | xargs ctags --python-kinds=-i
clean:
rm -rf $(TMP) build dist fmf.egg-info .cache .pytest_cache
find . -type f -name "*.py[co]" -delete
find . -type f -name "*,cover" -delete
find . -type d -name "__pycache__" -delete
cd docs && make clean
rm -f .coverage tags