summaryrefslogtreecommitdiffstats
path: root/py_rules.mk
blob: c84d279cfb7bebd902b4b78a5e1daba62556fac5 (plain)
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
# License: GPL v2 or later
# Copyright Red Hat Inc. 2008

ifndef DESTDIR
	DESTDIR = /
endif

ifndef PY_SOURCES
	PY_SOURCES = $(wildcard src/*.py)
endif

ifndef SETUP_PY
	SETUP_PY = setup.py
endif

ifndef PY_TOPDIR
	PY_TOPDIR = $(abspath $(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
endif

#_SETUP_PY = $(PY_TOPDIR)/$(SETUP_PY)
_SETUP_PY = $(SETUP_PY)

$(_SETUP_PY):	$(_SETUP_PY).in
	sed -e 's/@VERSION@/$(PKGVERSION)/g' < $< > $@

py-build-ext:	$(_SETUP_PY) $(PY_SOURCES)
	python $(SETUP_PY) build_ext -i

py-build:   $(_SETUP_PY) $(PY_SOURCES)
	python $(SETUP_PY) build

py-install:	$(_SETUP_PY)
	python $(SETUP_PY) install -O1 --skip-build --root $(DESTDIR)

py-clean:	$(_SETUP_PY)
	python $(SETUP_PY) clean; \
	rm -f $(SETUP_PY); \
	rm -rf build

py-check:
	pychecker -F pycheckrc $(PY_SOURCES)