From f8298a955f9138c14404ab8a172827175399f19f Mon Sep 17 00:00:00 2001 From: Johan Andersson Date: Tue, 10 Jul 2018 22:22:51 +0200 Subject: [PATCH] bring back old method of making the binary --- Makefile | 7 ++++++- lib/Makefile | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 lib/Makefile diff --git a/Makefile b/Makefile index daa3457..6200019 100644 --- a/Makefile +++ b/Makefile @@ -27,6 +27,11 @@ export PYTHONPATH=lib # nosetests3), you can remove the -3 flag. TEST_OPTS ?= -2 -3 +svtplay-dl: $(PYFILES) + $(MAKE) -C lib + mv -f lib/svtplay-dl . + + svtplay-dl.1: svtplay-dl.pod rm -f $@ $(POD2MAN) $< $@ @@ -56,4 +61,4 @@ clean: $(MAKE) -C lib clean rm -f svtplay-dl rm -f $(MANFILE) - rm -f .tox + rm -rf .tox diff --git a/lib/Makefile b/lib/Makefile new file mode 100644 index 0000000..98f2fc6 --- /dev/null +++ b/lib/Makefile @@ -0,0 +1,49 @@ +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 + +VERSION = $(shell git describe 2>/dev/null || echo $(LATEST_RELEASE)-unknown) + +svtplay-dl: $(PYFILES) + @# Verify that there's no .build already \ + ! [ -d .build ] || { \ + echo "ERROR: build already in progress? (or remove $(PWD)/.build/)"; \ + 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 + + # Add git version info to __version__, seen in --version + 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