6
TEST_COMMAND_PY2 = trial --unclean-warnings $(TRIAL_ARGS) landscape
7
TEST_COMMAND_PY3 = trial3 --unclean-warnings $(TRIAL_ARGS) landscape
8
READY_FILE := py3_ready_tests
9
PY3_READY := `cat $(READY_FILE)`
10
TEST_COMMAND_PY3_READY = TRIAL_ARGS= trial3 --unclean-warnings $(PY3_READY)
11
UBUNTU_RELEASE := $(shell lsb_release -cs)
12
# version in the code is authoritative
13
# Use := here, not =, it's really important, otherwise UPSTREAM_VERSION
14
# will be updated behind your back with the current result of that
15
# command everytime it is mentioned/used.
16
UPSTREAM_VERSION := $(shell python -c "from landscape import UPSTREAM_VERSION; print UPSTREAM_VERSION")
17
CHANGELOG_VERSION := $(shell dpkg-parsechangelog | grep ^Version | cut -f 2 -d " " | cut -f 1 -d '-')
18
BZR_REVNO := $(shell bzr revno)
19
ifeq (+bzr,$(findstring +bzr,$(UPSTREAM_VERSION)))
20
TARBALL_VERSION := $(UPSTREAM_VERSION)
22
TARBALL_VERSION := $(UPSTREAM_VERSION)+bzr$(BZR_REVNO)
26
help: ## Print help about available targets
27
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
30
depends: depends2 depends3 ## Install py2 and py3 dependencies.
34
sudo apt -y install python-twisted-core python-distutils-extra python-mock python-configobj python-passlib
38
sudo apt -y install python3-twisted python3-distutils-extra python3-mock python3-configobj python3-passlib
43
build: build2 build3 ## Build.
47
$(PYTHON) setup.py build_ext -i
51
$(PYTHON3) setup.py build_ext -i
55
-trial --unclean-warnings --reporter=summary landscape > _last_py2_res
56
-trial3 --unclean-warnings landscape
57
./display_py2_testresults
60
check: check2 check3-ready ## Run all the tests.
64
LC_ALL=C $(TEST_COMMAND_PY2)
68
LC_ALL=C $(TEST_COMMAND_PY3)
71
check3-ready: ## Run py3 tests for ported modules (listed in py3_ready_tests).
72
LC_ALL=C $(TEST_COMMAND_PY3_READY)
75
ci-check: depends build check ## Install dependencies and run all the tests.
83
-pyflakes `find landscape -name \*py`
86
-find landscape -name \*.pyc -exec rm -f {} \;
93
doc: docs/api/twisted/pickle
95
${PYDOCTOR} --make-html --html-output docs/api --add-package landscape --extra-system=docs/api/twisted/pickle:twisted/
97
docs/api/twisted/pickle:
98
mkdir -p docs/api/twisted
99
-${PYDOCTOR} --make-html --html-output docs/api/twisted --add-package /usr/share/pyshared/twisted -o docs/api/twisted/pickle
102
LC_ALL=C ${TXT2MAN} -P Landscape -s 1 -t landscape-client < man/landscape-client.txt > man/landscape-client.1
103
LC_ALL=C ${TXT2MAN} -P Landscape -s 1 -t landscape-config < man/landscape-config.txt > man/landscape-config.1
104
LC_ALL=C ${TXT2MAN} -P Landscape -s 1 -t landscape-sysinfo < man/landscape-sysinfo.txt > man/landscape-sysinfo.1
107
cp -f sdist/landscape-client-$(TARBALL_VERSION).tar.gz \
108
../landscape-client_$(TARBALL_VERSION).orig.tar.gz
111
# add a temporary entry for a local build if needed
112
ifeq (,$(findstring +bzr,$(CHANGELOG_VERSION)))
113
dch -v $(TARBALL_VERSION)-0ubuntu0 "New local test build" --distribution $(UBUNTU_RELEASE)
115
# just update the timestamp
116
dch --distribution $(UBUNTU_RELEASE) --release $(UBUNTU_RELEASE)
120
sed -i -e "s/^UPSTREAM_VERSION.*/UPSTREAM_VERSION = \"$(TARBALL_VERSION)\"/g" \
121
landscape/__init__.py
123
package: clean prepchangelog updateversion
124
debuild -b $(DEBUILD_OPTS)
126
sourcepackage: clean origtarball prepchangelog updateversion
127
# need to remove sdist here because it doesn't exist in the
130
debuild -S $(DEBUILD_OPTS)
132
MESSAGE_DIR = `pwd`/runclient-messages
133
LOG_FILE = `pwd`/runclient.log
136
-sudo rm -rf $(MESSAGE_DIR)
137
-sudo mkdir $(MESSAGE_DIR)
140
-sudo ./landscape-client \
141
-a onward -t "John's PC" \
142
-u http://localhost:8080/message-system \
144
--urgent-exchange-interval=5 \
146
--ping-url=http://localhost:8081/ping \
148
freshrun: freshdata run
151
-ctags --languages=python -R .
154
-etags --languages=python -R .
157
make sdist TARBALL_VERSION=$(UPSTREAM_VERSION)
161
# --uncommitted because we want any changes the developer might have made
162
# locally to be included in the package without having to commit
163
bzr export --uncommitted sdist/landscape-client-$(TARBALL_VERSION)
164
rm -rf sdist/landscape-client-$(TARBALL_VERSION)/debian
165
sed -i -e "s/^UPSTREAM_VERSION.*/UPSTREAM_VERSION = \"$(TARBALL_VERSION)\"/g" \
166
sdist/landscape-client-$(TARBALL_VERSION)/landscape/__init__.py
167
cd sdist && tar cfz landscape-client-$(TARBALL_VERSION).tar.gz landscape-client-$(TARBALL_VERSION)
168
cd sdist && md5sum landscape-client-$(TARBALL_VERSION).tar.gz > landscape-client-$(TARBALL_VERSION).tar.gz.md5
169
rm -rf sdist/landscape-client-$(TARBALL_VERSION)
171
.PHONY: tags etags freshdata run freshrun package sourcepackage updateversion origtarball prepchangelog lint releasetarball
172
.DEFAULT_GOAL := help