File: Makefile

package info (click to toggle)
dtrx 8.5.3-3
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,756 kB
  • sloc: python: 1,841; javascript: 51; makefile: 37; sh: 21
file content (43 lines) | stat: -rw-r--r-- 1,617 bytes parent folder | download | duplicates (2)
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
# A small bit of automation for various steps in building + releasing dtrx

DTRX_TAGNAME=$(shell python -c 'from dtrx import dtrx; print(dtrx.VERSION)')

# require make 4.3+ for grouped targets
MINIMUM_MAKE_VERSION = 4.3
MAKE_TEST_VERSION = $(shell printf "%s\n%s" $(MAKE_VERSION) $(MINIMUM_MAKE_VERSION) | sort --version-sort)
ifneq ($(MINIMUM_MAKE_VERSION),$(firstword $(MAKE_TEST_VERSION)))
$(error Make version is too low. Please upgrade to $(MINIMUM_MAKE_VERSION) or higher.)
endif

BUILD_ARTIFACTS= \
    dist/dtrx-$(DTRX_TAGNAME).py \
    dist/dtrx-$(DTRX_TAGNAME).pyz \
    dist/dtrx-8.3.0-py2.py3-none-any.whl \
    dist/dtrx-8.3.0.tar.gz \

.PHONY: build
build: $(BUILD_ARTIFACTS)

# copy the standalone script too into ./dist/
dist/dtrx-$(DTRX_TAGNAME).py: dtrx/dtrx.py
	mkdir -p $(dir $@)
	cp $^ $@

# generate a zipapp
dist/dtrx-$(DTRX_TAGNAME).pyz: dtrx/dtrx.py
	mkdir -p $(dir $@)
	python -m zipapp dtrx --compress --main "dtrx:main" --python "/usr/bin/env python" --output $@

# build the wheel and source dist
dist/dtrx-8.3.0-py2.py3-none-any.whl dist/dtrx-8.3.0.tar.gz &: dtrx/dtrx.py
	python -m build

.PHONY: publish-release
publish-release: $(BUILD_ARTIFACTS)
# first confirm that we're on a tag
	git describe --exact-match || (echo ERROR: not on a tag; false)
# prompt before firing off the release
	@echo -n "About to publish to GitHub and PyPi, are you sure? [y/N] " && read ans && [ $${ans:-'N'} = 'y' ]
	gh release create --generate-notes $(DTRX_TAGNAME)
	gh release upload $(DTRX_TAGNAME) dist/*
	twine upload dist/dtrx-$(DTRX_TAGNAME).tar.gz dist/dtrx-$(DTRX_TAGNAME)-py2.py3-none-any.whl