diff --git a/.gitignore b/.gitignore index fa9a7e4b..bfa441d1 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,4 @@ node_modules/ .coverage htmlcov/ .venv/ -snooty.tar.bz2 +dist/ diff --git a/Makefile b/Makefile index ea361431..30e8c1f3 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,10 @@ -.PHONY: help lint test clean publish +.PHONY: help lint test clean flit-publish SYSTEM_PYTHON=$(shell which python3) +PLATFORM=$(shell printf '%s_%s' "$$(uname -s | tr '[:upper:]' '[:lower:]')" "$$(uname -m)") +VERSION=$(shell $(SYSTEM_PYTHON) -c 'exec(open("snooty/__init__.py").read()); print(__version__)') export SOURCE_DATE_EPOCH = $(shell date +%s) -# UNAME_S := $(shell uname -s) -# ifeq ($(UNAME_S),Darwin) -# export CPPFLAGS="-I/usr/local/Cellar/snappy/1.1.7_1/include/ -L/usr/local/lib" -# endif - help: ## Show this help message @grep -E '^[a-zA-Z_.0-9-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' @@ -27,25 +24,28 @@ lint: .venv/.EXISTS ## Run all linting test: lint ## Run unit tests . .venv/bin/activate && python3 -m pytest --cov=snooty -snooty.dist/.EXISTS: test - -rm -rf snooty.dist +dist/snooty/.EXISTS: + $(MAKE) test + -rm -rf snooty.dist dist + mkdir dist echo 'from snooty import main; main.main()' > snooty.py PYTHONHOME=`pwd`/.venv python3 -m nuitka \ --standalone --python-flag=no_site --remove-output \ - snooty.py + --lto snooty.py rm snooty.py + mv snooty.dist dist/snooty touch $@ -snooty.tar.bz2: snooty/rstspec.toml snooty.dist/.EXISTS ## Build a binary tarball +dist/snooty-${VERSION}-${PLATFORM}.tar.bz2: snooty/rstspec.toml dist/snooty/.EXISTS ## Build a binary tarball install -m644 snooty/rstspec.toml snooty.dist - tar -cjf $@ snooty.dist/ + tar -cjf $@ -C dist snooty -snooty.tar.bz2.asc: snooty.tar.bz2 ## Build and sign a binary tarball +dist/snooty-${VERSION}-${PLATFORM}.tar.bz2.asc: dist/snooty-${VERSION}-${PLATFORM}.tar.bz2 ## Build and sign a binary tarball gpg --armor --detach-sig $^ clean: ## Remove all build artifacts - -rm -r snooty.tar.bz2* snooty.py .venv + -rm -r snooty.tar.bz2* snooty.py .venv dist -rm -rf snooty.dist -publish: test ## Deploy the package to pypi +flit-publish: test ## Deploy the package to pypi SOURCE_DATE_EPOCH="$$SOURCE_DATE_EPOCH" flit publish diff --git a/pyproject.toml b/pyproject.toml index 70a3eb51..65fb4b3c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ home-page = "https://github.com/mongodb/snooty-parser" classifiers = ["License :: OSI Approved :: Apache Software License"] requires-python = "~= 3.7" requires = [ - "pymongo[snappy,srv,tls] ~= 3.7.2", + "pymongo[srv,tls] ~= 3.7.2", "docutils ~= 0.14", "dnspython ~= 1.16.0", "watchdog ~= 0.9.0",