plugin.video.viervijfzes/Makefile

97 lines
3.2 KiB
Makefile
Raw Normal View History

2020-07-09 10:16:45 +02:00
export KODI_HOME := $(CURDIR)/tests/home
export KODI_INTERACTIVE := 0
PYTHON := python
2020-11-12 14:38:10 +01:00
KODI_PYTHON_ABIS := 3.0.0 2.26.0
2020-03-19 16:45:31 +01:00
# Collect information to build as sensible package name
name = $(shell xmllint --xpath 'string(/addon/@id)' addon.xml)
2020-03-19 16:45:31 +01:00
version = $(shell xmllint --xpath 'string(/addon/@version)' addon.xml)
git_branch = $(shell git rev-parse --abbrev-ref HEAD)
git_hash = $(shell git rev-parse --short HEAD)
2020-11-12 14:38:10 +01:00
ifdef release
zip_name = $(name)-$(version).zip
else
zip_name = $(name)-$(version)-$(git_branch)-$(git_hash).zip
endif
include_files = addon_entry.py addon.xml CHANGELOG.md LICENSE README.md resources/ service_entry.py
2020-03-19 16:45:31 +01:00
include_paths = $(patsubst %,$(name)/%,$(include_files))
exclude_files = \*.new \*.orig \*.pyc \*.pyo
languages = $(filter-out en_gb, $(patsubst resources/language/resource.language.%, %, $(wildcard resources/language/*)))
2020-03-19 16:45:31 +01:00
all: check test build
zip: build
check: check-pylint check-tox check-translations
check-pylint:
@echo ">>> Running pylint checks"
@$(PYTHON) -m pylint *.py resources/lib/ tests/
2020-03-19 16:45:31 +01:00
check-tox:
@echo ">>> Running tox checks"
@$(PYTHON) -m tox -q
2020-03-19 16:45:31 +01:00
check-translations:
@echo ">>> Running translation checks"
@$(foreach lang,$(languages), \
msgcmp resources/language/resource.language.$(lang)/strings.po resources/language/resource.language.en_gb/strings.po; \
)
2020-04-20 16:09:00 +02:00
@tests/check_for_unused_translations.py
2020-03-19 16:45:31 +01:00
check-addon: clean build
@echo ">>> Running addon checks"
$(eval TMPDIR := $(shell mktemp -d))
@unzip ../${zip_name} -d ${TMPDIR}
cd ${TMPDIR} && kodi-addon-checker --branch=leia
@rm -rf ${TMPDIR}
codefix:
@isort -l 160 resources/
2020-03-19 16:45:31 +01:00
test: test-unit
test-unit:
@echo ">>> Running unit tests"
2020-11-28 17:13:21 +01:00
@$(PYTHON) -m pytest tests
2020-03-19 16:45:31 +01:00
clean:
@find . -name '*.py[cod]' -type f -delete
2020-03-19 16:45:31 +01:00
@find . -name '__pycache__' -type d -delete
@rm -rf .pytest_cache/ .tox/ tests/cdm tests/userdata/temp
2020-03-19 16:45:31 +01:00
@rm -f *.log .coverage
build: clean
@echo ">>> Building package"
@rm -f ../$(zip_name)
cd ..; zip -r $(zip_name) $(include_paths) -x $(exclude_files)
@echo "Successfully wrote package as: ../$(zip_name)"
2020-11-12 14:38:10 +01:00
# You first need to run sudo gem install github_changelog_generator for this
release:
ifneq ($(release),)
@github_changelog_generator -u add-ons -p plugin.video.viervijfzes --no-issues --exclude-labels duplicate,question,invalid,wontfix release --future-release v$(release);
@echo "cd /addon/@version\nset $$release\nsave\nbye" | xmllint --shell addon.xml; \
date=$(shell date '+%Y-%m-%d'); \
echo "cd /addon/extension[@point='xbmc.addon.metadata']/news\nset v$$release ($$date)\nsave\nbye" | xmllint --shell addon.xml; \
# Next steps to release:
# - Modify the news-section of addons.xml
# - git add . && git commit -m "Prepare for v$(release)" && git push
# - git tag v$(release) && git push --tags
else
@echo "Usage: make release release=1.0.0"
endif
multizip: clean
@-$(foreach abi,$(KODI_PYTHON_ABIS), \
echo "cd /addon/requires/import[@addon='xbmc.python']/@version\nset $(abi)\nsave\nbye" | xmllint --shell addon.xml; \
matrix=$(findstring $(abi), $(word 1,$(KODI_PYTHON_ABIS))); \
if [ $$matrix ]; then version=$(version)+matrix.1; else version=$(version); fi; \
echo "cd /addon/@version\nset $$version\nsave\nbye" | xmllint --shell addon.xml; \
make build; \
)