File: rules

package info (click to toggle)
logilab-common 1.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,136 kB
  • ctags: 2,018
  • sloc: python: 10,605; makefile: 56
file content (91 lines) | stat: -rwxr-xr-x 3,483 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

include /usr/share/python/python.mk

# Python default library and script directories
LIB := $(shell python -c "from distutils.command.build import build ; from distutils.core import Distribution ; b = build(Distribution()) ; b.finalize_options() ; print b.build_purelib")
SCRIPT := $(shell python -c "from distutils.command.build import build ; from distutils.core import Distribution ; b = build(Distribution()) ; b.finalize_options() ; print b.build_scripts")
LIB3 := $(shell python3 -c "from distutils.command.build import build ; from distutils.core import Distribution ; b = build(Distribution()) ; b.finalize_options() ; print (b.build_purelib)")
SCRIPT3 := $(shell python3 -c "from distutils.command.build import build ; from distutils.core import Distribution ; b = build(Distribution()) ; b.finalize_options() ; print (b.build_scripts)")

%:
	dh $@ --with python2,python3

override_dh_auto_build:
	# python module build
	NO_SETUPTOOLS=1 python setup.py build
	NO_SETUPTOOLS=1 python3 setup.py build

	# we need this hack because we have to import "logilab.common.pytest"
	# and for doc generation, but since it's a namespace package,
	# we need to "simulate" it
	touch $(CURDIR)/$(LIB)/logilab/__init__.py

	# build doc
	$(MAKE) -C doc

	# remove dummy file
	rm -f $(CURDIR)/$(LIB)/logilab/__init__.py

override_dh_auto_test:
ifeq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),)
	# we need this hack because we have to import "logilab.common.pytest"
	# and for doc generation, but since it's a namespace package,
	# we need to "simulate" it
	touch $(CURDIR)/$(LIB)/logilab/__init__.py
	touch $(CURDIR)/$(LIB3)/logilab/__init__.py

	# run tests
	# use the default python version to select the script dir to run the tests
	-PYTHONPATH=$(CURDIR)/$(LIB)/   $(CURDIR)/$(SCRIPT)/logilab-pytest  -t $(CURDIR)/test
	-PYTHONPATH=$(CURDIR)/$(LIB3)/ $(CURDIR)/$(SCRIPT3)/logilab-pytest -t $(CURDIR)/test

	# remove dummy file
	rm -f $(CURDIR)/$(LIB)/logilab/__init__.py
	rm -f $(CURDIR)/$(LIB3)/logilab/__init__.py
endif

override_dh_auto_clean:
	# clean doc
	$(MAKE) -C doc clean

	NO_SETUPTOOLS=1 python setup.py clean
	NO_SETUPTOOLS=1 python3 setup.py clean

	find . -name "*.pyc" -delete

	dh_clean

override_dh_auto_install: build
	NO_SETUPTOOLS=1 python setup.py install --no-compile \
		--root=$(CURDIR)/debian/python-logilab-common/ \
		${py_setup_install_args}
	NO_SETUPTOOLS=1 python3 setup.py install --no-compile \
		--root=$(CURDIR)/debian/python3-logilab-common/ \
		${py_setup_install_args}
	# move logilab-pytest to logilab-pytest3 for py3k package
	mv debian/python3-logilab-common/usr/bin/logilab-pytest debian/python3-logilab-common/usr/bin/logilab-pytest3
	# remove __pycache__ dirs
	find $(CURDIR)/debian/python3-logilab-common -type d -name "__pycache__" | xargs rm -rf
	# remove test directory
	rm -rf debian/python-logilab-common/usr/lib/python*/*-packages/logilab/common/test
	rm -rf debian/python3-logilab-common/usr/lib/python*/*-packages/logilab/common/test

override_dh_installchangelogs:
	dh_installchangelogs	ChangeLog

override_dh_installdocs:
	dh_installdocs		README doc/apidoc/

override_dh_installman:
	dh_installman
	# install the manpage for the py3k package
	cp doc/logilab-pytest.1 doc/logilab-pytest3.1
	dh_installman -p python3-logilab-common doc/logilab-pytest3.1
	rm doc/logilab-pytest3.1

override_dh_compress:
	dh_compress		-X.py -X.ini -X.xml -Xtest/ -Xapidoc/