forked from daanvandevliet/script.elementum.jackett
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
48 lines (37 loc) · 1.22 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
NAME = script.elementum.jackett
GIT = git
LAST_GIT_TAG = $(shell $(GIT) describe --tags)
GIT_VERSION = $(shell $(GIT) describe --abbrev=0 --tags --exact-match 2>/dev/null || echo -n "$(LAST_GIT_TAG)-snapshot")
ZIP = zip
ZIP_SUFFIX = zip
ZIP_FILE = $(NAME).$(ZIP_SUFFIX)
BUILD_BASE = build
BUILD_DIR = $(BUILD_BASE)/$(NAME)
all: clean deps-prod locales zip
.PHONY: build-prod
build-prod: clean deps-prod $(ZIP_FILE)
.PHONY: deps-prod
deps-prod: clean deps-prod $(ZIP_FILE)
@poetry install --no-dev
$(BUILD_DIR):
@mkdir -p $(BUILD_DIR)
deps-dev:
@poetry install
$(ZIP_FILE): $(BUILD_DIR)
$(GIT) archive --format tar --worktree-attributes HEAD | tar -xvf - -C $(BUILD_DIR)
@poetry export -f requirements.txt | \
poetry run pip install \
--requirement /dev/stdin \
--target $(BUILD_DIR)/resources/libs \
--progress-bar off \
--install-option="--install-scripts=$$(mktemp -d)"
@find $(BUILD_DIR) -iname "*.egg-info" -or -iname "*.pyo" -or -iname "*.pyc" | xargs rm -rf
@poetry run ./scripts/update-version.py $(GIT_VERSION) > $(BUILD_DIR)/addon.xml
@(cd $(BUILD_BASE) && $(ZIP) -r $(CURDIR)/$(ZIP_FILE) $(NAME))
.PHONY: zip
zip: $(ZIP_FILE)
clean:
rm -f $(ZIP_FILE)
rm -rf $(BUILD_DIR)
locales:
scripts/xgettext_merge.sh