-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
83 lines (69 loc) · 2.5 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
# gnumakefile
SHELL=/bin/sh
NOW:=$(shell date +'%Y.%m.%d_%H:%M:%S')
PYTHON:=$(shell type -p python2 || type -p python)
NOSETESTS:=$(shell type -p nosetests2 || type -p nosetests)
PACKAGE:=$(shell $(PYTHON) -c 'from butter.version import PACKAGE; print PACKAGE')
VERSION:=$(shell $(PYTHON) -c 'from butter.version import VERSION; print VERSION')
URL:=$(shell $(PYTHON) -c 'from butter.version import URL; print URL')
SRCURL:=$(shell $(PYTHON) -c 'from butter.version import SRCURL; print SRCURL')
TARBALL:=dist/$(PACKAGE)-$(VERSION).tar.gz
.PHONY: arch clean clobber coverage default dist install lint test version
default: test
dist: clobber $(TARBALL) arch
clean:
-rm -rf build cover .coverage MANIFEST
-rm -rf pkg/arch/{pkg,src,*.gz,*.xz}
-rm -f pkg/arch/PKGBUILD.local
-find butter -name \*.py[co] | xargs rm
clobber: clean
-rm -rf dist
#test:
# PYTHONPATH=$(PWD) ${NOSETESTS} -s
#coverage:
# PYTHONPATH=$(PWD) ${NOSETESTS} -s --with-coverage --cover-package=beyond --cover-html
lint:
pylint --rcfile=pylint.cfg butter
$(TARBALL): setup.py butter/*.py butter/*/*.py
-rm -rf dist build
PYTHONPATH=$(PWD) ${NOSETESTS} -s
$(PYTHON) setup.py sdist
install:
$(PYTHON) setup.py install
version: arch-version
@echo "# updated version to $(VERSION) in all packages"
# ------------------------------------------------------------------------
# ArchLinux packaging
# ------------------------------------------------------------------------
archdev:
-pacman -R --noconfirm $(PACKAGE)
make clobber arch
pacman -U --noconfirm dist/*xz
arch: $(TARBALL)
echo $(TARBALL)
mkdir -p dist
rm -f dist/PKGBUILD* dist/*.pkg.tar.xz
MD5=$$(md5sum $(TARBALL) | awk '{print $$1}'); \
sed -e "s|@PACKAGE@|$(PACKAGE)|g; \
s|@VERSION@|$(VERSION)|g; \
s|@RELEASE@|1|g; \
s|@URL@|$(URL)|g; \
s|@SOURCE@|$(SRCURL)|g; \
s|@MD5@|$$MD5|g; \
s|@GIT_BUILD@|no|g;" \
< "pkg/arch/PKGBUILD" > "dist/PKGBUILD"
sed -e "s|^source=.*|source=($(notdir $(TARBALL)))|; \
s|^pkgrel=.*|pkgrel=$(NOW)|g" \
< "dist/PKGBUILD" > "dist/PKGBUILD.local"
sed -e "s|@PACKAGE@|$(PACKAGE)|g; \
s|@VERSION@|$(VERSION)|g; \
s|@RELEASE@|\$$(date +'%Y.%m.%d_%H:%M:%S')|g; \
s|@URL@|$(URL)|g; \
s|@SOURCE@||g; \
s|@MD5@||g; \
s|@GIT_BUILD@|yes|g;" \
< "pkg/arch/PKGBUILD" > "dist/PKGBUILD.git"
@echo "# created $(cd dist; ls PKGBUILD*)"
cd dist; makepkg -cfp PKGBUILD.local --asroot
rm dist/PKGBUILD.local
@echo "# created $(ls dist/*xz)"