]> arthur.barton.de Git - bup.git/commitdiff
Install bup-python and rely on it everywhere
authorRob Browning <rlb@defaultvalue.org>
Sat, 12 Oct 2019 22:23:42 +0000 (17:23 -0500)
committerRob Browning <rlb@defaultvalue.org>
Sun, 1 Dec 2019 19:10:35 +0000 (13:10 -0600)
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>
.gitignore
Makefile
cmd/python-cmd.sh [new file with mode: 0644]

index 3a20ea324878807c3c9afb88d2d119728dd3f885..d82e27a4430f9c5cc1bec61413359d1f82fbad11 100644 (file)
@@ -1,6 +1,5 @@
 /bup
 /cmd/bup-*
-/cmd/python-cmd.sh
 randomgen
 memtest
 *.o
index a7c413dbf0355f2eaa980ae1f86caad5a90f3a9d..a9ddbd15b106f20e6d15ab042964b3c863bc0222 100644 (file)
--- 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 (file)
index 0000000..6de5867
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+set -e
+
+# This last line will be replaced with 'exec some/python "$@"