From: Rob Browning Date: Sat, 12 Oct 2019 22:23:42 +0000 (-0500) Subject: Install bup-python and rely on it everywhere X-Git-Tag: 0.31~246 X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=bup.git;a=commitdiff_plain;h=ef1fb5b7593dfa3694f3bb737c168e402f8c912e;ds=sidebyside Install bup-python and rely on it everywhere Add a cmd/python-cmd.sh template and use it to generate cmd/bup-python. Install bup-python alongside all the other commands and stop rewriting the command #! headers at install time, so that they'll use it. We're setting up all of the commands to rely on bup-python so that we'll have a common place to establish some norms that we'll want in order to support Python 3. Though in fact, you can't actually run the python-based subcommands independently because they don't have the right PYTHONPATH, etc. That's something we'll also fix. Signed-off-by: Rob Browning Tested-by: Rob Browning --- diff --git a/.gitignore b/.gitignore index 3a20ea3..d82e27a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ /bup /cmd/bup-* -/cmd/python-cmd.sh randomgen memtest *.o diff --git a/Makefile b/Makefile index a7c413d..a9ddbd1 100644 --- a/Makefile +++ b/Makefile @@ -46,7 +46,7 @@ config/config.vars: configure config/configure config/configure.inc \ $(wildcard config/*.in) MAKE="$(MAKE)" ./configure -bup_cmds := cmd/bup-python\ +bup_cmds := cmd/bup-python \ $(patsubst cmd/%-cmd.py,cmd/bup-%,$(wildcard cmd/*-cmd.py)) \ $(patsubst cmd/%-cmd.sh,cmd/bup-%,$(wildcard cmd/*-cmd.sh)) @@ -99,10 +99,7 @@ install: all test -z "$(man_html)" || install -d $(dest_docdir) test -z "$(man_html)" || $(INSTALL) -m 0644 $(man_html) $(dest_docdir) $(call install-python-bin,bup,"$(dest_bindir)/bup") - set -e; \ - for cmd in $$(ls cmd/bup-* | grep -v cmd/bup-python); do \ - $(call install-python-bin,"$$cmd","$(dest_libdir)/$$cmd") \ - done + $(INSTALL) -pm 0755 cmd/bup-* $(dest_libdir)/cmd/ $(INSTALL) -pm 0644 \ lib/bup/*.py \ $(dest_libdir)/bup @@ -255,11 +252,11 @@ check: test distcheck: all ./wvtest run t/test-release-archive.sh -cmd/python-cmd.sh: config/config.vars Makefile - printf "#!/bin/sh\nexec %q \"\$$@\"" "$(bup_python)" \ - >> cmd/python-cmd.sh.$$PPID.tmp - chmod +x cmd/python-cmd.sh.$$PPID.tmp - mv cmd/python-cmd.sh.$$PPID.tmp cmd/python-cmd.sh +cmd/bup-python: cmd/python-cmd.sh config/config.vars Makefile + head -n -1 $< > "$@".$$PPID.tmp + printf "exec %q \"\$$@\"\n" "$(bup_python)" >> "$@".$$PPID.tmp + chmod +x "$@".$$PPID.tmp + mv "$@".$$PPID.tmp "$@" long-test: export BUP_TEST_LEVEL=11 long-test: test @@ -341,4 +338,4 @@ clean: Documentation/clean cmd/bup-python ./configure-version --clean t/configure-sampledata --clean # Remove last so that cleanup tools can depend on it - rm -f cmd/bup-python cmd/python-cmd.sh + rm -f cmd/bup-python diff --git a/cmd/python-cmd.sh b/cmd/python-cmd.sh new file mode 100644 index 0000000..6de5867 --- /dev/null +++ b/cmd/python-cmd.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +set -e + +# This last line will be replaced with 'exec some/python "$@"