X-Git-Url: https://arthur.barton.de/gitweb/?a=blobdiff_plain;f=main.py;h=c0679e32919fa0a6b721ce70bd4eed8add70dcc4;hb=579409999b16b296bfb75b544179bbf4e9213257;hp=154c5dc393b8d7493d037e77aec2c29f69a55bdd;hpb=80addc3f11e41101ed3a30aa17d4d8741d5592b9;p=bup.git diff --git a/main.py b/main.py index 154c5dc..c0679e3 100755 --- a/main.py +++ b/main.py @@ -5,9 +5,15 @@ exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble -from __future__ import absolute_import +from __future__ import absolute_import, print_function import errno, re, sys, os, subprocess, signal, getopt +if sys.version_info[0] != 2 \ + and not os.environ.get('BUP_ALLOW_UNEXPECTED_PYTHON_VERSION') == 'true': + print('error: bup may crash with python versions other than 2, or eat your data', + file=sys.stderr) + sys.exit(2) + from subprocess import PIPE from sys import stderr, stdout import select @@ -169,7 +175,8 @@ def print_clean_line(dest, content, width, sep=None): os.write(dest, content) if len(content) < width: os.write(dest, ' ' * (width - len(content))) - os.write(dest, sep) + if sep: + os.write(dest, sep) def filter_output(src_out, src_err, dest_out, dest_err): """Transfer data from src_out to dest_out and src_err to dest_err via