ff96bf4b70
Switch from 'cp -r cloud_sync' to 'cp cloud_sync/*.py' so .pyc files from a prior dev run don't get embedded. Pyz shrinks 112 KB -> 44 KB.
37 lines
986 B
Makefile
37 lines
986 B
Makefile
.PHONY: build test clean install help
|
|
|
|
PY := python3
|
|
|
|
help:
|
|
@echo "Targets:"
|
|
@echo " build — produce cloud-sync.pyz (single-file zipapp)"
|
|
@echo " test — run pytest"
|
|
@echo " install — pip install -e ."
|
|
@echo " clean — remove built artifacts"
|
|
|
|
build: cloud-sync.pyz
|
|
|
|
# zipapp builds from a source dir; to preserve the cloud_sync/ package
|
|
# structure inside the archive we stage it under build/pyz first, then
|
|
# point zipapp at that staging dir.
|
|
cloud-sync.pyz: cloud_sync/__main__.py $(wildcard cloud_sync/*.py)
|
|
rm -rf build/pyz
|
|
mkdir -p build/pyz/cloud_sync
|
|
cp cloud_sync/*.py build/pyz/cloud_sync/
|
|
$(PY) -m zipapp build/pyz -p "/usr/bin/env $(PY)" \
|
|
-m cloud_sync.cli:main -o $@
|
|
rm -rf build/pyz
|
|
@echo "built: $@ ($$(stat -c '%s' $@) bytes)"
|
|
|
|
test:
|
|
$(PY) -m pytest tests/ -v
|
|
|
|
install:
|
|
$(PY) -m pip install -e .
|
|
|
|
clean:
|
|
rm -f cloud-sync.pyz
|
|
rm -rf build/ dist/ *.egg-info __pycache__ \
|
|
cloud_sync/__pycache__ tests/__pycache__ \
|
|
.pytest_cache
|