Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make use of git archive #32

Merged
merged 1 commit into from
Feb 1, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 15 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ ifdef release
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
include_paths = $(patsubst %,$(name)/%,$(include_files))
exclude_files = \*.new \*.orig \*.pyc \*.pyo
zip_dir = $(name)/

languages = $(filter-out en_gb, $(patsubst resources/language/resource.language.%, %, $(wildcard resources/language/*)))

Expand All @@ -27,18 +24,18 @@ zip: build
check: check-pylint check-translations

check-pylint:
@echo ">>> Running pylint checks"
@printf ">>> Running pylint checks\n"
@$(PYTHON) -m pylint *.py resources/lib/ tests/

check-translations:
@echo ">>> Running translation checks"
@printf ">>> Running translation checks\n"
@$(foreach lang,$(languages), \
msgcmp resources/language/resource.language.$(lang)/strings.po resources/language/resource.language.en_gb/strings.po; \
)
@tests/check_for_unused_translations.py

check-addon: clean build
@echo ">>> Running addon checks"
@printf ">>> Running addon checks\n"
$(eval TMPDIR := $(shell mktemp -d))
@unzip ../${zip_name} -d ${TMPDIR}
cd ${TMPDIR} && kodi-addon-checker --branch=leia
Expand All @@ -50,42 +47,43 @@ codefix:
test: test-unit

test-unit:
@echo ">>> Running unit tests"
@printf ">>> Running unit tests\n"
@$(PYTHON) -m pytest tests

clean:
@printf ">>> Cleaning up\n"
@find . -name '*.py[cod]' -type f -delete
@find . -name '__pycache__' -type d -delete
@rm -rf .pytest_cache/ tests/cdm tests/userdata/temp
@rm -f *.log .coverage

build: clean
@echo ">>> Building package"
@printf ">>> Building package\n"
@rm -f ../$(zip_name)
cd ..; zip -r $(zip_name) $(include_paths) -x $(exclude_files)
@echo "Successfully wrote package as: ../$(zip_name)"
@git archive --format zip --worktree-attributes -v -o ../$(zip_name) --prefix $(zip_dir) $(or $(shell git stash create), HEAD)
@printf ">>> Successfully wrote package as: ../$(zip_name)\n"

release:
ifneq ($(release),)
@github_changelog_generator -u add-ons -p plugin.video.tvvlaanderen --no-issues --exclude-labels duplicate,question,invalid,wontfix,release --future-release v$(release);
@github_changelog_generator -u add-ons -p $(name) --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; \
@printf "cd /addon/@version\nset $$release\nsave\nbye\n" | 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; \
printf "cd /addon/extension[@point='xbmc.addon.metadata']/news\nset v$$release ($$date)\nsave\nbye\n" | 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"
@printf "Usage: make release release=1.0.0\n"
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; \
printf "cd /addon/requires/import[@addon='xbmc.python']/@version\nset $(abi)\nsave\nbye\n" | 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; \
printf "cd /addon/@version\nset $$version\nsave\nbye\n" | xmllint --shell addon.xml; \
make build; \
)