Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Commit

Permalink
Add build script.
Browse files Browse the repository at this point in the history
  • Loading branch information
muhuk committed Dec 13, 2022
1 parent 5442b3e commit a6fe775
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
40 changes: 40 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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)'"
4 changes: 4 additions & 0 deletions build_excludes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
__pycache__/
.mypy_cache/
.mypy.ini
mypy.ini

0 comments on commit a6fe775

Please sign in to comment.