1- .PHONY : help lint test clean publish
1+ .PHONY : help lint test clean flit- publish
22
33SYSTEM_PYTHON =$(shell which python3)
4+ PLATFORM =$(shell printf '% s_% s' "$$(uname -s | tr '[:upper:]' '[:lower:]' ) " "$$(uname -m ) ")
5+ VERSION =$(shell $(SYSTEM_PYTHON ) -c 'exec(open("snooty/__init__.py") .read()); print(__version__)')
46export SOURCE_DATE_EPOCH = $(shell date +% s)
57
6- # UNAME_S := $(shell uname -s)
7- # ifeq ($(UNAME_S),Darwin)
8- # export CPPFLAGS="-I/usr/local/Cellar/snappy/1.1.7_1/include/ -L/usr/local/lib"
9- # endif
10-
118help : # # Show this help message
129 @grep -E ' ^[a-zA-Z_.0-9-]+:.*?## .*$$' $(MAKEFILE_LIST ) | awk ' BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
1310
@@ -27,25 +24,28 @@ lint: .venv/.EXISTS ## Run all linting
2724test : lint # # Run unit tests
2825 . .venv/bin/activate && python3 -m pytest --cov=snooty
2926
30- snooty.dist/.EXISTS : test
31- -rm -rf snooty.dist
27+ dist/snooty/.EXISTS :
28+ $(MAKE ) test
29+ -rm -rf snooty.dist dist
30+ mkdir dist
3231 echo ' from snooty import main; main.main()' > snooty.py
3332 PYTHONHOME=` pwd` /.venv python3 -m nuitka \
3433 --standalone --python-flag=no_site --remove-output \
35- snooty.py
34+ --lto snooty.py
3635 rm snooty.py
36+ mv snooty.dist dist/snooty
3737 touch $@
3838
39- snooty.tar.bz2 : snooty/rstspec.toml snooty. dist/.EXISTS # # Build a binary tarball
39+ dist/ snooty-${VERSION}-${PLATFORM} .tar.bz2 : snooty/rstspec.toml dist/snooty /.EXISTS # # Build a binary tarball
4040 install -m644 snooty/rstspec.toml snooty.dist
41- tar -cjf $@ snooty. dist/
41+ tar -cjf $@ -C dist snooty
4242
43- snooty.tar.bz2.asc : snooty.tar.bz2 # # Build and sign a binary tarball
43+ dist/ snooty-${VERSION}-${PLATFORM} .tar.bz2.asc : dist/ snooty-${VERSION}-${PLATFORM} .tar.bz2 # # Build and sign a binary tarball
4444 gpg --armor --detach-sig $^
4545
4646clean : # # Remove all build artifacts
47- -rm -r snooty.tar.bz2* snooty.py .venv
47+ -rm -r snooty.tar.bz2* snooty.py .venv dist
4848 -rm -rf snooty.dist
4949
50- publish : test # # Deploy the package to pypi
50+ flit- publish : test # # Deploy the package to pypi
5151 SOURCE_DATE_EPOCH=" $$ SOURCE_DATE_EPOCH" flit publish
0 commit comments