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 <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
$(wildcard config/*.in)
MAKE="$(MAKE)" ./configure
$(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))
$(patsubst cmd/%-cmd.py,cmd/bup-%,$(wildcard cmd/*-cmd.py)) \
$(patsubst cmd/%-cmd.sh,cmd/bup-%,$(wildcard cmd/*-cmd.sh))
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")
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
$(INSTALL) -pm 0644 \
lib/bup/*.py \
$(dest_libdir)/bup
distcheck: all
./wvtest run t/test-release-archive.sh
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
long-test: export BUP_TEST_LEVEL=11
long-test: test
./configure-version --clean
t/configure-sampledata --clean
# Remove last so that cleanup tools can depend on it
./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
--- /dev/null
+#!/bin/sh
+
+set -e
+
+# This last line will be replaced with 'exec some/python "$@"