-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
57 lines (49 loc) · 1.25 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
49
50
51
52
53
54
55
56
57
# 定义变量
DIST_DIR=dist
BUILD_DIR=build
BUILD_CMD=python setup.py sdist bdist_wheel
CLEAN_CMD=rm -rf $(DIST_DIR) $(BUILD_DIR) *.egg-info
WHL_FILE=$(wildcard $(DIST_DIR)/*.whl)
PACKAGE_NAME=sight-training
UPLOAD_CMD=twine upload $(DIST_DIR)/*
# 默认目标
.PHONY: all
all: clean build
# 构建项目
.PHONY: build
build: clean
$(BUILD_CMD)
# 清理构建产物
.PHONY: clean
clean:
find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch
$(CLEAN_CMD)
# 安装包
.PHONY: install
install:
@if [ -z "$(WHL_FILE)" ]; then \
echo "No .whl file found in $(DIST_DIR). Please run 'make build' first."; \
else \
pip install $(WHL_FILE); \
fi
# 卸载包
.PHONY: uninstall
uninstall:
pip uninstall -y $(PACKAGE_NAME)
# 上传包到 PyPI
.PHONY: upload
upload:
$(UPLOAD_CMD)
app:
pyinstaller spacex01.spec
# 帮助信息
.PHONY: help
help:
@echo "Available commands:"
@echo " build - Build the package."
@echo " clean - Remove build artifacts."
@echo " install - Install the package using the built wheel file."
@echo " uninstall - Uninstall the package."
@echo " upload - Upload the package to PyPI."
@echo " all - Clean the build environment and then build the package."
@echo " help - Show this help message."