File: rules

package info (click to toggle)
migrate 0.11.0-5
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,000 kB
  • sloc: python: 5,853; makefile: 113; sh: 107
file content (79 lines) | stat: -rwxr-xr-x 2,923 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
#!/usr/bin/make -f

PYTHONS:=$(shell pyversions -vr)
PYTHON3S:=$(shell py3versions -vr)

UPSTREAM_GIT := https://github.com/openstack/sqlalchemy-migrate.git
include /usr/share/openstack-pkg-tools/pkgos.make

export OSLO_PACKAGE_VERSION=$(VERSION)

include /usr/share/python/python.mk

LAST_CHANGE = $(shell dpkg-parsechangelog -S Date)
BUILD_DATE  = $(shell LC_ALL=C date -u "+%B %d, %Y" -d "$(LAST_CHANGE)")

%:
	dh $@ --buildsystem=python_distutils --with python2,python3,sphinxdoc

override_dh_auto_clean:
	rm -rf dist build
	find . -name '*\.py[co]' -exec rm {} \;
	rm -f docs/reference.txt debian/install
	cp debian/test_db.cfg $(CURDIR)
	rm -rf .testrepository

override_dh_auto_install:
	set -e ; for pyvers in $(PYTHONS); do \
		python$$pyvers setup.py install --install-layout=deb \
			--root $(CURDIR)/debian/python-migrate; \
	done
	set -e ; for pyvers in $(PYTHON3S); do \
		python$$pyvers setup.py install --install-layout=deb \
		--root $(CURDIR)/debian/python3-migrate; \
	done
	rm -f $(CURDIR)/debian/python*/usr/lib/python*/dist-packages/*.pth
	mv $(CURDIR)/debian/python-migrate/usr/bin/migrate $(CURDIR)/debian/python-migrate/usr/bin/python2-migrate
	mv $(CURDIR)/debian/python3-migrate/usr/bin/migrate $(CURDIR)/debian/python3-migrate/usr/bin/python3-migrate
	mv $(CURDIR)/debian/python-migrate/usr/bin/migrate-repository $(CURDIR)/debian/python-migrate/usr/bin/python2-migrate-repository
	mv $(CURDIR)/debian/python3-migrate/usr/bin/migrate-repository $(CURDIR)/debian/python3-migrate/usr/bin/python3-migrate-repository

override_dh_python3:
	dh_python3 --shebang=/usr/bin/python3

override_dh_sphinxdoc:
ifeq (,$(findstring nodocs, $(DEB_BUILD_OPTIONS)))
	PYTHONPATH=$(CURDIR) sphinx-build -b html -a -E -N -D today="$(BUILD_DATE)" doc/source debian/python-migrate-doc/usr/share/doc/python-migrate-doc/html/
	dh_sphinxdoc -O--buildsystem=python_distutils
endif

override_dh_installchangelogs:
	dh_installchangelogs -i doc/source/changelog.rst

override_dh_compress:
	dh_compress -i -X.py -X.rst -X.js -Xobjects.inv

override_dh_auto_test:
ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
	chmod +x debian/test.sh

	# Create a working "migrate" binary, so that shell calls continue to
	# work even without python-migrate being installed
	mkdir -p debian/bin
	cp debian/migrate-for-tests debian/bin/migrate
	sed -i "s#REPLACE_THIS_PATH#$(CURDIR)#" debian/bin/migrate

	# Create a minimalist egg-info, so that "import migrate"
	# works and gets the correct version
	mkdir -p sqlalchemy_migrate-$(VERSION).egg-info
	echo "Metadata-Version: 1.1" >sqlalchemy_migrate-$(VERSION).egg-info/PKG-INFO
	echo "Name: sqlalchemy-migrate" >>sqlalchemy_migrate-$(VERSION).egg-info/PKG-INFO
	echo "Version: $(VERSION)" >>sqlalchemy_migrate-$(VERSION).egg-info/PKG-INFO

	# Launch the actual tests
	$(CURDIR)/debian/test.sh

	# Clean everything
	rm -rf debian/bin
	rm -rf sqlalchemy_migrate-$(VERSION).egg-info
endif