-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
44 lines (37 loc) · 1.36 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
DESTDIR=
PREFIX=/usr
NAME=ec2imgutils
MANPATH=/usr/share/man
dirs = lib man
files = Makefile README.md LICENSE ec2deprecateimg ec2listimg ec2publishimg ec2removeimg ec2uploadimg setup.py requirements-dev.txt requirements.txt
verSpec = $(shell rpm -q --specfile --qf '%{VERSION}' *.spec)
verSrc = $(shell cat lib/ec2imgutils/VERSION)
ifneq "$(verSpec)" "$(verSrc)"
$(error "Version mismatch, will not take any action")
endif
clean:
@find . -name "*.pyc" | xargs rm -f
@find . -name "__pycache__" | xargs rm -rf
@find . -name "*.cache" | xargs rm -rf
@find . -name "*.egg-info" | xargs rm -rf
pep8: clean
@pep8 -v --statistics lib/ec2utils/*
@pep8 -v --statistics --ignore=E402 tests/*.py
tar: clean
rm -rf $(NAME)-$(verSrc)
mkdir $(NAME)-$(verSrc)
mkdir -p "$(NAME)-$(verSrc)"/man/man1
cp -r $(dirs) $(files) "$(NAME)-$(verSrc)"
tar -cjf "$(NAME)-$(verSrc).tar.bz2" "$(NAME)-$(verSrc)"
rm -rf "$(NAME)-$(verSrc)"
test:
py.test tests
install:
python3 setup.py install --prefix="$(PREFIX)" --root="$(DESTDIR)"
install -d -m 755 "$(DESTDIR)"/"$(MANDIR)"/man1
install -m 644 man/man1/* "$(DESTDIR)"/"$(MANDIR)"/man1
gzip "$(DESTDIR)"/"$(MANDIR)"/man1/ec2deprecateimg.1
gzip "$(DESTDIR)"/"$(MANDIR)"/man1/ec2listimg.1
gzip "$(DESTDIR)"/"$(MANDIR)"/man1/ec2publishimg.1
gzip "$(DESTDIR)"/"$(MANDIR)"/man1/ec2removeimg.1
gzip "$(DESTDIR)"/"$(MANDIR)"/man1/ec2uploadimg.1