diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b13fce4 --- /dev/null +++ b/Makefile @@ -0,0 +1,40 @@ +NAME = "guvp" +VERSION = $(shell ack "\"version\":\s*\((\d+),\s*(\d+)\)" $(NAME)/__init__.py --output="\$$1.\$$2" --nocolor) +PACKAGE_NAME = $(NAME)-$(VERSION) + +SOURCE_DIR = $(NAME) +BUILD_DIR = ./release + + +.DEFAULT_GOAL := check + +.PHONY: clean build relase tag version + +build: + @mkdir -p $(BUILD_DIR)/$(PACKAGE_NAME) + @rsync -av --exclude-from=build_excludes.txt ./$(SOURCE_DIR)/ $(BUILD_DIR)/$(PACKAGE_NAME)/$(NAME) + @cp COPYING.txt $(BUILD_DIR)/$(PACKAGE_NAME)/$(NAME) + @cp CHANGELOG.md $(BUILD_DIR)/$(PACKAGE_NAME)/$(NAME) + @cd $(BUILD_DIR)/$(PACKAGE_NAME); zip -r "$(PACKAGE_NAME).zip" $(NAME) + @mv $(BUILD_DIR)/$(PACKAGE_NAME)/$(PACKAGE_NAME).zip $(BUILD_DIR)/ + @echo "Created '$(BUILD_DIR)/$(PACKAGE_NAME).zip'" + +check: + @flake8 --show-source $(SOURCE_DIR) + +clean: + @rm -rf $(BUILD_DIR) + @echo "Deleted $(BUILD_DIR)" + +release: clean check version build tag + @echo "Done" + +tag: + @git tag -a "v$(VERSION)" -m "Version $(VERSION)" + @echo "Created tag 'v$(VERSION)'" + @echo "Don't forget to run:" + @echo + @echo " git push origin --tags" + +version: + @echo "Version = '$(VERSION)'" diff --git a/build_excludes.txt b/build_excludes.txt new file mode 100644 index 0000000..10896ae --- /dev/null +++ b/build_excludes.txt @@ -0,0 +1,4 @@ +__pycache__/ +.mypy_cache/ +.mypy.ini +mypy.ini