-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
40 lines (31 loc) · 1.25 KB
/
Makefile
File metadata and controls
40 lines (31 loc) · 1.25 KB
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
################################################################################
NAME = $(shell python3 -c "import tomllib; d=tomllib.load(open('pyproject.toml','rb')); print(d['project']['name'])")
VERSION = $(shell python3 -c "import tomllib; d=tomllib.load(open('pyproject.toml','rb')); print(d['project']['version'])")
RELEASE = $(shell rpmspec --srpm -q --qf '%{release}' $(NAME).spec)
APP_FULLNAME = $(NAME)-$(VERSION)
DIST_DIR = dist/$(APP_FULLNAME)
TARBALL = dist/$(APP_FULLNAME).tar.gz
# All files needed to build the RPM should be listed here
DIST_FILES = $(NAME).spec pyproject.toml README.md
DIST_DIRS = config src
################################################################################
.PHONY: all clean dist rpm
all: rpm
clean:
rm -rf dist
dist: clean
mkdir -p $(DIST_DIR)
cp $(DIST_FILES) $(DIST_DIR)
cp -a $(DIST_DIRS) $(DIST_DIR)
uv build --wheel --out-dir $(DIST_DIR)
tar czf $(TARBALL) --exclude='__pycache__' -C dist $(APP_FULLNAME)
rpm: dist
rpmbuild -vv -tb $(TARBALL) \
-D 'py_name $(NAME)' \
-D 'py_version $(VERSION)' \
-D '_topdir /rpmbuild'
cp -f /rpmbuild/RPMS/**/*.rpm dist/
if test -w "${GITHUB_ENV}"; then \
echo "name=$(NAME)" >> $$GITHUB_ENV; \
echo "version=$(VERSION)-$(RELEASE)" >> $$GITHUB_ENV; \
fi