forked from ashcrow/flagon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
112 lines (91 loc) · 3.7 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
########################################################
# Makefile for python-flagon
#
# useful targets (not all implemented yet!):
# make clean ------------------- Clean up garbage
# make pyflakes/pep8/coverage -- source code checks
# make tests ------------------- run all unit tests (export LOG=true for /tmp/ logging)
########################################################
# > VARIABLE = value
#
# Normal setting of a variable - values within it are recursively
# expanded when the variable is USED, not when it's declared.
#
# > VARIABLE := value
#
# Setting of a variable with simple expansion of the values inside -
# values within it are expanded at DECLARATION time.
########################################################
# # This doesn't evaluate until it's called. The -D argument is the
# # directory of the target file ($@), kinda like `dirname`.
# ASCII2MAN = a2x -D $(dir $@) -d manpage -f manpage $<
# MANPAGES := docs/man/man1/re-rest.1
NAME := flagon
PKGNAME := python-flagon
RPMSPECDIR := contrib/rpm
RPMSPEC := $(RPMSPECDIR)/$(PKGNAME).spec
# VERSION file provides one place to update the software version.
VERSION := $(shell cat VERSION)
RPMRELEASE = $(shell awk '/global _short_release/{print $$NF; exit}' $(RPMSPEC).in)
# Build the spec file on the fly. Substitute version numbers from the
# # canonical VERSION file.
$(RPMSPECDIR)/$(PKGNAME).spec: $(RPMSPECDIR)/$(PKGNAME).spec.in
sed "s/%VERSION%/$(VERSION)/" $< > $@
# Build the distutils setup file on the fly.
setup.py: setup.py.in VERSION $(RPMSPECDIR)/$(PKGNAME).spec.in
sed -e "s/%VERSION%/$(VERSION)/" -e "s/%RELEASE%/$(RPMRELEASE)/" $< > $@
tag:
git tag -s -m $(TAG) $(TAG)
tests: coverage pep8 pyflakes
:
coverage:
@echo "#############################################"
@echo "# Running Unit + Coverage Tests"
@echo "#############################################"
nosetests -v --with-cover --cover-min-percentage=80 --cover-package=flagon test/
clean:
@find . -type f -regex ".*\.py[co]$$" -delete
@find . -type f \( -name "*~" -or -name "#*" \) -delete
@rm -fR build cover dist rpm-build MANIFEST htmlcov .coverage flagon.egg-info
pep8:
@echo "#############################################"
@echo "# Running PEP8 Compliance Tests"
@echo "#############################################"
pep8 --ignore=E501,E121,E124 src/flagon/
pyflakes:
@echo "#############################################"
@echo "# Running Pyflakes Sanity Tests"
@echo "# Note: most import errors may be ignored"
@echo "#############################################"
-pyflakes src/flagon
install: clean
python ./setup.py install
sdist: setup.py clean
python setup.py sdist
rpmcommon: $(RPMSPECDIR)/$(PKGNAME).spec sdist
@mkdir -p rpm-build
@cp dist/$(NAME)-$(VERSION).tar.gz rpm-build/$(NAME)-$(VERSION).tar.gz
srpm: rpmcommon
@rpmbuild --define "_topdir %(pwd)/rpm-build" \
--define "_builddir %{_topdir}" \
--define "_rpmdir %{_topdir}" \
--define "_srcrpmdir %{_topdir}" \
--define "_specdir $(RPMSPECDIR)" \
--define "_sourcedir %{_topdir}" \
-bs $(RPMSPEC)
@echo "#############################################"
@echo "$(PKGNAME) SRPM is built:"
@find rpm-build -maxdepth 2 -name '$(PKGNAME)*src.rpm' | awk '{print " " $$1}'
@echo "#############################################"
rpm: rpmcommon
@rpmbuild --define "_topdir %(pwd)/rpm-build" \
--define "_builddir %{_topdir}" \
--define "_rpmdir %{_topdir}" \
--define "_srcrpmdir %{_topdir}" \
--define "_specdir $(RPMSPECDIR)" \
--define "_sourcedir %{_topdir}" \
-ba $(RPMSPEC)
@echo "#############################################"
@echo "$(PKGNAME) RPMs are built:"
@find rpm-build -maxdepth 2 -name '$(PKGNAME)*.rpm' | awk '{print " " $$1}'
@echo "#############################################"