Makefile 1.43 KB
Newer Older
Michal Horejsek's avatar
Michal Horejsek committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

.PHONY: all prepare-dev test lint run-py2 run-py3 build clean

FPM_CMD=fpm -f -d sshpass -m 'haas@nic.cz' -s python
FPM_CMD_PY2=${FPM_CMD} --python-bin /usr/bin/python2 --python-package-name-prefix python
FPM_CMD_PY3=${FPM_CMD} --python-bin /usr/bin/python3 --python-package-name-prefix python3

all:
	@echo "make prepare-dev"
	@echo "make test"
	@echo "make lint"
	@echo "make run"
	@echo "make build"
	@echo "make clean"


prepare-dev:
18
	apt-get install -y python python-dev python-pip python3 python3-dev python3-pip sshpass
19 20
	python2 -m pip install "twisted>=16.0"
	python3 -m pip install "twisted>=16.6"
Michal Horejsek's avatar
Michal Horejsek committed
21 22

	# Test dependencies
Michal Horejsek's avatar
Michal Horejsek committed
23 24
	python2 -m pip install pylint pytest mock
	python3 -m pip install pylint pytest
Michal Horejsek's avatar
Michal Horejsek committed
25 26

    # Build dependencies
Michal Horejsek's avatar
Michal Horejsek committed
27
	apt-get install -y ruby ruby-dev rubygems build-essential rpm
Michal Horejsek's avatar
Michal Horejsek committed
28 29 30
	gem install --no-ri --no-rdoc fpm

test:
31 32
	if [ `which python2` ]; then python2 -m pytest test_honeypot_proxy.py; fi
	if [ `which python3` ]; then python3 -m pytest test_honeypot_proxy.py; fi
Michal Horejsek's avatar
Michal Horejsek committed
33 34 35 36 37

lint:
	python3 -m pylint --rcfile=pylintrc honeypot_proxy.py

run-py2:
38
	sudo python2 honeypot_proxy.py --device-token 42
Michal Horejsek's avatar
Michal Horejsek committed
39
run-py3:
40
	sudo python3 honeypot_proxy.py --device-token 42
Michal Horejsek's avatar
Michal Horejsek committed
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55

build:
	# Debian packages
	${FPM_CMD_PY2} -t deb setup.py
	${FPM_CMD_PY3} -t deb setup.py

	# Red Hat packages
	${FPM_CMD_PY2} -t rpm setup.py
	${FPM_CMD_PY3} -t rpm setup.py

    # Just archive, no deps
	${FPM_CMD} -t tar setup.py

clean:
	python setup.py clean
Michal Horejsek's avatar
Michal Horejsek committed
56
	rm -rf *.deb *.rpm *.tar