]> arthur.barton.de Git - bup.git/blob - lib/cmd/tick-cmd.py
Bypass Python 3 glibc argv problems by routing args through env
[bup.git] / lib / cmd / tick-cmd.py
1 #!/bin/sh
2 """": # -*-python-*-
3 # https://sourceware.org/bugzilla/show_bug.cgi?id=26034
4 export "BUP_ARGV_0"="$0"
5 arg_i=1
6 for arg in "$@"; do
7     export "BUP_ARGV_${arg_i}"="$arg"
8     shift
9     arg_i=$((arg_i + 1))
10 done
11 # Here to end of preamble replaced during install
12 bup_python="$(dirname "$0")/bup-python" || exit $?
13 exec "$bup_python" "$0"
14 """
15 # end of bup preamble
16
17 from __future__ import absolute_import
18 import sys, time
19
20 from bup import compat, options
21
22 optspec = """
23 bup tick
24 """
25 o = options.Options(optspec)
26 opt, flags, extra = o.parse(compat.argv[1:])
27
28 if extra:
29     o.fatal("no arguments expected")
30
31 t = time.time()
32 tleft = 1 - (t - int(t))
33 time.sleep(tleft)