2018-07-10 22:22:51 +02:00
|
|
|
all: svtplay-dl
|
|
|
|
|
|
|
|
clean:
|
|
|
|
find . -name '*.pyc' -exec rm {} \;
|
|
|
|
rm -f svtplay-dl
|
|
|
|
|
|
|
|
pylint:
|
|
|
|
pylint $(PYLINT_OPTS) svtplay_dl
|
|
|
|
|
|
|
|
export PACKAGES = svtplay_dl \
|
|
|
|
svtplay_dl.fetcher \
|
|
|
|
svtplay_dl.utils \
|
|
|
|
svtplay_dl.service \
|
|
|
|
svtplay_dl.subtitle \
|
|
|
|
svtplay_dl.postprocess
|
|
|
|
export PYFILES = $(sort $(addsuffix /*.py,$(subst .,/,$(PACKAGES))))
|
|
|
|
|
|
|
|
PYTHON ?= /usr/bin/env python3
|
|
|
|
|
2021-04-23 20:31:23 +02:00
|
|
|
VERSION = $(shell git describe --tags --dirty --always 2>/dev/null || echo $(LATEST_RELEASE)-unknown)
|
2018-07-10 22:22:51 +02:00
|
|
|
|
|
|
|
svtplay-dl: $(PYFILES)
|
2022-09-29 23:07:09 +02:00
|
|
|
@# "Verify that there's no .build already"
|
2018-07-10 22:22:51 +02:00
|
|
|
! [ -d .build ] || { \
|
2022-09-29 23:00:52 +02:00
|
|
|
echo "ERROR: build already in progress? (or remove $(CURDIR)/.build/)"; \
|
2018-07-10 22:22:51 +02:00
|
|
|
exit 1; \
|
|
|
|
}; \
|
|
|
|
mkdir -p .build
|
|
|
|
|
|
|
|
@# Stage the files in .build for postprocessing
|
|
|
|
for py in $(PYFILES); do \
|
|
|
|
install -d ".build/$${py%/*}"; \
|
|
|
|
install $$py .build/$$py; \
|
|
|
|
done
|
|
|
|
|
2022-09-29 23:07:09 +02:00
|
|
|
@# Add git version info to __version__, seen in --version
|
2018-07-10 22:22:51 +02:00
|
|
|
sed -i -e 's/^__version__ = \(.*\)$$/__version__ = "$(VERSION)"/' \
|
|
|
|
.build/svtplay_dl/__init__.py
|
|
|
|
|
|
|
|
@# reset timestamps, to avoid non-determinism in zip file
|
|
|
|
find .build/ -exec touch -m -t 198001010000 {} \;
|
|
|
|
|
|
|
|
(cd .build && zip -X --quiet svtplay-dl $(PYFILES))
|
|
|
|
(cd .build && zip -X --quiet --junk-paths svtplay-dl svtplay_dl/__main__.py)
|
|
|
|
|
|
|
|
echo '#!$(PYTHON)' > svtplay-dl
|
|
|
|
cat .build/svtplay-dl.zip >> svtplay-dl
|
|
|
|
rm -rf .build
|
|
|
|
chmod a+x svtplay-dl
|