From: Rob Browning Date: Sat, 27 Jan 2018 17:40:02 +0000 (-0600) Subject: Use absolute_import from the __future__ everywhere X-Git-Tag: 0.30~109 X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=bup.git;a=commitdiff_plain;h=c40b3dd5fd74e72024fbaad3daf5a958aefa1c54 Use absolute_import from the __future__ everywhere Without this, among other things, we can end up with conflicts with new upstream modules. For example, given lib/bup/io.py: Traceback (most recent call last): File "/home/rlb/src/bup/main-4/cmd/bup-index", line 10, in from bup import metadata, options, git, index, drecurse, hlinkdb File "/home/rlb/src/bup/main-4/lib/bup/metadata.py", line 10, in from io import BytesIO ImportError: cannot import name BytesIO This switch also revealed a circular dependency between midx and git, and several places where we weren't qualifying our bup imports properly, i.e. "import git" rather than "from bup import git". Signed-off-by: Rob Browning Tested-by: Rob Browning --- diff --git a/buptest.py b/buptest.py index 14ca1c3..5d4fe05 100644 --- a/buptest.py +++ b/buptest.py @@ -1,5 +1,5 @@ -from __future__ import print_function +from __future__ import absolute_import, print_function from collections import namedtuple from contextlib import contextmanager from os.path import basename, dirname, realpath diff --git a/cmd/bloom-cmd.py b/cmd/bloom-cmd.py index ecf244c..0e7fbf4 100755 --- a/cmd/bloom-cmd.py +++ b/cmd/bloom-cmd.py @@ -5,6 +5,7 @@ exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble +from __future__ import absolute_import import glob, os, sys, tempfile from bup import options, git, bloom diff --git a/cmd/cat-file-cmd.py b/cmd/cat-file-cmd.py index 8aabb41..06e14f6 100755 --- a/cmd/cat-file-cmd.py +++ b/cmd/cat-file-cmd.py @@ -5,6 +5,7 @@ exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble +from __future__ import absolute_import import re, stat, sys from bup import options, git, vfs diff --git a/cmd/daemon-cmd.py b/cmd/daemon-cmd.py index 8386fc0..ba4b86a 100755 --- a/cmd/daemon-cmd.py +++ b/cmd/daemon-cmd.py @@ -4,6 +4,8 @@ bup_python="$(dirname "$0")/bup-python" || exit $? exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble + +from __future__ import absolute_import import sys, getopt, socket, subprocess, fcntl from bup import options, path from bup.helpers import * diff --git a/cmd/damage-cmd.py b/cmd/damage-cmd.py index 669148a..fa54bc9 100755 --- a/cmd/damage-cmd.py +++ b/cmd/damage-cmd.py @@ -5,6 +5,7 @@ exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble +from __future__ import absolute_import import sys, os, random from bup import options diff --git a/cmd/drecurse-cmd.py b/cmd/drecurse-cmd.py index bc537cb..21ee3a5 100755 --- a/cmd/drecurse-cmd.py +++ b/cmd/drecurse-cmd.py @@ -5,6 +5,7 @@ exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble +from __future__ import absolute_import from os.path import relpath import sys diff --git a/cmd/fsck-cmd.py b/cmd/fsck-cmd.py index 8c4d0b7..df43b67 100755 --- a/cmd/fsck-cmd.py +++ b/cmd/fsck-cmd.py @@ -5,6 +5,7 @@ exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble +from __future__ import absolute_import import sys, os, glob, subprocess from bup import options, git diff --git a/cmd/ftp-cmd.py b/cmd/ftp-cmd.py index ee2bff1..8bd57b6 100755 --- a/cmd/ftp-cmd.py +++ b/cmd/ftp-cmd.py @@ -5,6 +5,7 @@ exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble +from __future__ import absolute_import import sys, os, stat, fnmatch from bup import options, git, shquote, ls, vfs diff --git a/cmd/fuse-cmd.py b/cmd/fuse-cmd.py index ab0ec7e..d05bd5f 100755 --- a/cmd/fuse-cmd.py +++ b/cmd/fuse-cmd.py @@ -5,6 +5,7 @@ exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble +from __future__ import absolute_import import sys, os, errno try: diff --git a/cmd/gc-cmd.py b/cmd/gc-cmd.py index e0782ca..c4eeaff 100755 --- a/cmd/gc-cmd.py +++ b/cmd/gc-cmd.py @@ -5,6 +5,7 @@ exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble +from __future__ import absolute_import import sys from bup import git, options diff --git a/cmd/help-cmd.py b/cmd/help-cmd.py index 95155b6..384d0cf 100755 --- a/cmd/help-cmd.py +++ b/cmd/help-cmd.py @@ -4,6 +4,8 @@ bup_python="$(dirname "$0")/bup-python" || exit $? exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble + +from __future__ import absolute_import import sys, os, glob from bup import options, path diff --git a/cmd/import-duplicity-cmd.py b/cmd/import-duplicity-cmd.py index 812b6c7..565aca6 100755 --- a/cmd/import-duplicity-cmd.py +++ b/cmd/import-duplicity-cmd.py @@ -5,6 +5,7 @@ exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble +from __future__ import absolute_import from calendar import timegm from pipes import quote from subprocess import check_call diff --git a/cmd/index-cmd.py b/cmd/index-cmd.py index 2426f1f..539e89e 100755 --- a/cmd/index-cmd.py +++ b/cmd/index-cmd.py @@ -5,6 +5,7 @@ exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble +from __future__ import absolute_import import sys, stat, time, os, errno, re from bup import metadata, options, git, index, drecurse, hlinkdb diff --git a/cmd/init-cmd.py b/cmd/init-cmd.py index f2c0052..412ecec 100755 --- a/cmd/init-cmd.py +++ b/cmd/init-cmd.py @@ -5,6 +5,7 @@ exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble +from __future__ import absolute_import import sys from bup import git, options, client diff --git a/cmd/join-cmd.py b/cmd/join-cmd.py index b445e4d..68c31ee 100755 --- a/cmd/join-cmd.py +++ b/cmd/join-cmd.py @@ -5,6 +5,7 @@ exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble +from __future__ import absolute_import import sys from bup import git, options diff --git a/cmd/list-idx-cmd.py b/cmd/list-idx-cmd.py index d2c981b..227d8fe 100755 --- a/cmd/list-idx-cmd.py +++ b/cmd/list-idx-cmd.py @@ -5,6 +5,7 @@ exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble +from __future__ import absolute_import import sys, os from bup import git, options diff --git a/cmd/ls-cmd.py b/cmd/ls-cmd.py index 7dacce7..9180da3 100755 --- a/cmd/ls-cmd.py +++ b/cmd/ls-cmd.py @@ -5,6 +5,7 @@ exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble +from __future__ import absolute_import import sys from bup import git, ls diff --git a/cmd/margin-cmd.py b/cmd/margin-cmd.py index ca502b9..c042bf8 100755 --- a/cmd/margin-cmd.py +++ b/cmd/margin-cmd.py @@ -5,6 +5,7 @@ exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble +from __future__ import absolute_import import sys, struct, math from bup import options, git, _helpers diff --git a/cmd/memtest-cmd.py b/cmd/memtest-cmd.py index fb7a120..894bb64 100755 --- a/cmd/memtest-cmd.py +++ b/cmd/memtest-cmd.py @@ -5,6 +5,7 @@ exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble +from __future__ import absolute_import import sys, re, struct, time, resource from bup import git, bloom, midx, options, _helpers diff --git a/cmd/meta-cmd.py b/cmd/meta-cmd.py index 671abce..38ec943 100755 --- a/cmd/meta-cmd.py +++ b/cmd/meta-cmd.py @@ -12,6 +12,7 @@ exec "$bup_python" "$0" ${1+"$@"} # TODO: Add tar-like -C option. +from __future__ import absolute_import import sys from bup import metadata from bup import options diff --git a/cmd/midx-cmd.py b/cmd/midx-cmd.py index 7b4a2ad..1b81174 100755 --- a/cmd/midx-cmd.py +++ b/cmd/midx-cmd.py @@ -5,6 +5,7 @@ exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble +from __future__ import absolute_import import glob, math, os, resource, struct, sys, tempfile from bup import options, git, midx, _helpers, xstat diff --git a/cmd/mux-cmd.py b/cmd/mux-cmd.py index b7a6db1..3b55244 100755 --- a/cmd/mux-cmd.py +++ b/cmd/mux-cmd.py @@ -5,6 +5,7 @@ exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble +from __future__ import absolute_import import os, sys, subprocess, struct from bup import options diff --git a/cmd/on--server-cmd.py b/cmd/on--server-cmd.py index cdfd441..0d29e43 100755 --- a/cmd/on--server-cmd.py +++ b/cmd/on--server-cmd.py @@ -4,6 +4,8 @@ bup_python="$(dirname "$0")/bup-python" || exit $? exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble + +from __future__ import absolute_import import sys, os, struct from bup import options, helpers diff --git a/cmd/on-cmd.py b/cmd/on-cmd.py index 10b1e3f..e4f660c 100755 --- a/cmd/on-cmd.py +++ b/cmd/on-cmd.py @@ -5,6 +5,7 @@ exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble +from __future__ import absolute_import import sys, os, struct, getopt, subprocess, signal from subprocess import PIPE diff --git a/cmd/prune-older-cmd.py b/cmd/prune-older-cmd.py index 58c4d94..6c67b69 100755 --- a/cmd/prune-older-cmd.py +++ b/cmd/prune-older-cmd.py @@ -5,7 +5,7 @@ exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble -from __future__ import print_function +from __future__ import absolute_import, print_function from collections import defaultdict from itertools import groupby from sys import stderr diff --git a/cmd/random-cmd.py b/cmd/random-cmd.py index 868c3af..3eef820 100755 --- a/cmd/random-cmd.py +++ b/cmd/random-cmd.py @@ -5,6 +5,7 @@ exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble +from __future__ import absolute_import import os, sys from bup import options, _helpers diff --git a/cmd/restore-cmd.py b/cmd/restore-cmd.py index a9dbd3d..bb37811 100755 --- a/cmd/restore-cmd.py +++ b/cmd/restore-cmd.py @@ -5,7 +5,7 @@ exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble -from __future__ import print_function +from __future__ import absolute_import, print_function from stat import S_ISDIR import copy, errno, os, sys, stat, re diff --git a/cmd/rm-cmd.py b/cmd/rm-cmd.py index 13cb058..3464e3c 100755 --- a/cmd/rm-cmd.py +++ b/cmd/rm-cmd.py @@ -5,6 +5,7 @@ exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble +from __future__ import absolute_import import sys from bup.git import check_repo_or_die diff --git a/cmd/save-cmd.py b/cmd/save-cmd.py index f06e3a4..91d01ca 100755 --- a/cmd/save-cmd.py +++ b/cmd/save-cmd.py @@ -5,6 +5,7 @@ exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble +from __future__ import absolute_import from errno import EACCES from io import BytesIO import os, sys, stat, time, math diff --git a/cmd/server-cmd.py b/cmd/server-cmd.py index d13abc9..a60bf23 100755 --- a/cmd/server-cmd.py +++ b/cmd/server-cmd.py @@ -5,6 +5,7 @@ exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble +from __future__ import absolute_import import os, sys, struct, subprocess from bup import options, git diff --git a/cmd/split-cmd.py b/cmd/split-cmd.py index 80c7e0d..031a266 100755 --- a/cmd/split-cmd.py +++ b/cmd/split-cmd.py @@ -5,6 +5,7 @@ exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble +from __future__ import absolute_import import os, sys, time from bup import hashsplit, git, options, client diff --git a/cmd/tag-cmd.py b/cmd/tag-cmd.py index 492c3ba..00647b9 100755 --- a/cmd/tag-cmd.py +++ b/cmd/tag-cmd.py @@ -5,6 +5,7 @@ exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble +from __future__ import absolute_import import os, sys from bup import git, options diff --git a/cmd/tick-cmd.py b/cmd/tick-cmd.py index ce3d399..30e1d50 100755 --- a/cmd/tick-cmd.py +++ b/cmd/tick-cmd.py @@ -4,6 +4,8 @@ bup_python="$(dirname "$0")/bup-python" || exit $? exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble + +from __future__ import absolute_import import sys, time from bup import options diff --git a/cmd/version-cmd.py b/cmd/version-cmd.py index 9b23ea2..f7555a8 100755 --- a/cmd/version-cmd.py +++ b/cmd/version-cmd.py @@ -5,7 +5,7 @@ exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble -from __future__ import print_function +from __future__ import absolute_import, print_function import re, sys from bup import options diff --git a/cmd/web-cmd.py b/cmd/web-cmd.py index 9fdc322..810af2d 100755 --- a/cmd/web-cmd.py +++ b/cmd/web-cmd.py @@ -5,7 +5,7 @@ exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble -from __future__ import print_function +from __future__ import absolute_import, print_function from collections import namedtuple import mimetypes, os, posixpath, signal, stat, sys, time, urllib, webbrowser diff --git a/cmd/xstat-cmd.py b/cmd/xstat-cmd.py index 9f32845..aa43a53 100755 --- a/cmd/xstat-cmd.py +++ b/cmd/xstat-cmd.py @@ -4,11 +4,15 @@ bup_python="$(dirname "$0")/bup-python" || exit $? exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble + # Copyright (C) 2010 Rob Browning # # This code is covered under the terms of the GNU Library General # Public License as described in the bup LICENSE file. + +from __future__ import absolute_import import sys, stat, errno + from bup import metadata, options, xstat from bup.helpers import add_error, handle_ctrl_c, parse_timestamp, saved_errors, \ add_error, log diff --git a/lib/bup/bloom.py b/lib/bup/bloom.py index 7787866..54da4b8 100644 --- a/lib/bup/bloom.py +++ b/lib/bup/bloom.py @@ -80,6 +80,7 @@ None of this tells us what max_pfalse_positive to choose. Brandon Low 2011-02-04 """ +from __future__ import absolute_import import sys, os, math, mmap, struct from bup import _helpers diff --git a/lib/bup/client.py b/lib/bup/client.py index 7b786eb..8c364d1 100644 --- a/lib/bup/client.py +++ b/lib/bup/client.py @@ -1,4 +1,5 @@ +from __future__ import absolute_import import errno, os, re, struct, sys, time, zlib from bup import git, ssh diff --git a/lib/bup/compat.py b/lib/bup/compat.py index 51aabf8..8a14282 100644 --- a/lib/bup/compat.py +++ b/lib/bup/compat.py @@ -1,5 +1,5 @@ -from __future__ import print_function +from __future__ import absolute_import, print_function from traceback import print_exception import sys diff --git a/lib/bup/csetup.py b/lib/bup/csetup.py index 2446fe6..1cebf76 100644 --- a/lib/bup/csetup.py +++ b/lib/bup/csetup.py @@ -1,3 +1,6 @@ + +from __future__ import absolute_import + from distutils.core import setup, Extension _helpers_mod = Extension('_helpers', diff --git a/lib/bup/drecurse.py b/lib/bup/drecurse.py index 14bb721..24a0db9 100644 --- a/lib/bup/drecurse.py +++ b/lib/bup/drecurse.py @@ -1,4 +1,5 @@ +from __future__ import absolute_import import stat, os from bup.helpers import add_error, should_rx_exclude_path, debug1, resolve_parent diff --git a/lib/bup/gc.py b/lib/bup/gc.py index d05357c..29d5ad8 100644 --- a/lib/bup/gc.py +++ b/lib/bup/gc.py @@ -1,3 +1,5 @@ + +from __future__ import absolute_import import glob, os, subprocess, sys, tempfile from bup import bloom, git, midx from bup.git import MissingObject, walk_object diff --git a/lib/bup/git.py b/lib/bup/git.py index 8150f7c..70673a3 100644 --- a/lib/bup/git.py +++ b/lib/bup/git.py @@ -3,6 +3,7 @@ bup repositories are in Git format. This library allows us to interact with the Git data structures. """ +from __future__ import absolute_import import errno, os, sys, zlib, time, subprocess, struct, stat, re, tempfile, glob from collections import namedtuple from itertools import islice diff --git a/lib/bup/hashsplit.py b/lib/bup/hashsplit.py index 3a4fcb8..3cbcfc9 100644 --- a/lib/bup/hashsplit.py +++ b/lib/bup/hashsplit.py @@ -1,3 +1,5 @@ + +from __future__ import absolute_import import io, math, os from bup import _helpers, helpers diff --git a/lib/bup/helpers.py b/lib/bup/helpers.py index 4ead99a..583c65b 100644 --- a/lib/bup/helpers.py +++ b/lib/bup/helpers.py @@ -1,5 +1,6 @@ """Helper functions and classes for bup.""" +from __future__ import absolute_import from collections import namedtuple from contextlib import contextmanager from ctypes import sizeof, c_void_p diff --git a/lib/bup/hlinkdb.py b/lib/bup/hlinkdb.py index 5c1ec00..17957bd 100644 --- a/lib/bup/hlinkdb.py +++ b/lib/bup/hlinkdb.py @@ -1,3 +1,5 @@ + +from __future__ import absolute_import import cPickle, errno, os, tempfile from bup import compat diff --git a/lib/bup/index.py b/lib/bup/index.py index a488086..d6d44ac 100644 --- a/lib/bup/index.py +++ b/lib/bup/index.py @@ -1,6 +1,8 @@ -import errno, metadata, os, stat, struct, tempfile -from bup import xstat +from __future__ import absolute_import +import errno, os, stat, struct, tempfile + +from bup import metadata, xstat from bup._helpers import UINT_MAX, bytescmp from bup.helpers import (add_error, log, merge_iter, mmap_readwrite, progress, qprogress, resolve_parent, slashappend) diff --git a/lib/bup/ls.py b/lib/bup/ls.py index 78717ac..7b3d9ea 100644 --- a/lib/bup/ls.py +++ b/lib/bup/ls.py @@ -1,14 +1,14 @@ """Common code for listing files from a bup repository.""" -from __future__ import print_function +from __future__ import absolute_import, print_function from itertools import chain from stat import S_ISDIR, S_ISLNK -import copy, locale, os.path, stat, sys, xstat +import copy, locale, os.path, stat, sys -from bup import metadata, options, vfs +from bup import metadata, options, vfs, xstat from bup.options import Options from bup.repo import LocalRepo, RemoteRepo -from helpers import columnate, istty1, last, log +from bup.helpers import columnate, istty1, last, log def item_hash(item, tree_for_commit): """If the item is a Commit, return its commit oid, otherwise return diff --git a/lib/bup/metadata.py b/lib/bup/metadata.py index 8ceebdc..e5337c9 100644 --- a/lib/bup/metadata.py +++ b/lib/bup/metadata.py @@ -5,6 +5,7 @@ # This code is covered under the terms of the GNU Library General # Public License as described in the bup LICENSE file. +from __future__ import absolute_import from copy import deepcopy from errno import EACCES, EINVAL, ENOTTY, ENOSYS, EOPNOTSUPP from io import BytesIO diff --git a/lib/bup/midx.py b/lib/bup/midx.py index a4ef37b..a24b104 100644 --- a/lib/bup/midx.py +++ b/lib/bup/midx.py @@ -1,4 +1,5 @@ +from __future__ import absolute_import import glob, mmap, os, struct from bup import _helpers diff --git a/lib/bup/options.py b/lib/bup/options.py index b4b5282..394b71d 100644 --- a/lib/bup/options.py +++ b/lib/bup/options.py @@ -60,6 +60,8 @@ Options can be put in different groups. Options in the same group must be on consecutive lines. Groups are formed by inserting a line that begins with a space. The text on that line will be output after an empty line. """ + +from __future__ import absolute_import import sys, os, textwrap, getopt, re, struct try: diff --git a/lib/bup/path.py b/lib/bup/path.py index 820c78b..9b9445e 100644 --- a/lib/bup/path.py +++ b/lib/bup/path.py @@ -1,6 +1,8 @@ """This is a separate module so we can cleanly getcwd() before anyone does chdir(). """ + +from __future__ import absolute_import import sys, os startdir = os.getcwd() diff --git a/lib/bup/repo.py b/lib/bup/repo.py index 25a94b0..ca09219 100644 --- a/lib/bup/repo.py +++ b/lib/bup/repo.py @@ -1,4 +1,5 @@ +from __future__ import absolute_import from functools import partial from bup import client, git diff --git a/lib/bup/rm.py b/lib/bup/rm.py index 453de34..5345114 100644 --- a/lib/bup/rm.py +++ b/lib/bup/rm.py @@ -1,4 +1,5 @@ +from __future__ import absolute_import import sys from bup import compat, git, vfs diff --git a/lib/bup/shquote.py b/lib/bup/shquote.py index a3cd4c4..d7e451a 100644 --- a/lib/bup/shquote.py +++ b/lib/bup/shquote.py @@ -1,3 +1,5 @@ + +from __future__ import absolute_import import re q = "'" diff --git a/lib/bup/ssh.py b/lib/bup/ssh.py index 34b5f3c..97ab312 100644 --- a/lib/bup/ssh.py +++ b/lib/bup/ssh.py @@ -1,6 +1,8 @@ """SSH connection. Connect to a remote host via SSH and execute a command on the host. """ + +from __future__ import absolute_import import sys, os, re, subprocess from bup import helpers, path diff --git a/lib/bup/t/__init__.py b/lib/bup/t/__init__.py index 172f040..580ba19 100644 --- a/lib/bup/t/__init__.py +++ b/lib/bup/t/__init__.py @@ -1,2 +1,5 @@ + +from __future__ import absolute_import import sys + sys.path[:0] = ['../..'] diff --git a/lib/bup/t/tbloom.py b/lib/bup/t/tbloom.py index f47f482..2f17046 100644 --- a/lib/bup/t/tbloom.py +++ b/lib/bup/t/tbloom.py @@ -1,4 +1,5 @@ +from __future__ import absolute_import import errno, platform, tempfile from wvtest import * diff --git a/lib/bup/t/tclient.py b/lib/bup/t/tclient.py index 4a3147c..8a810e9 100644 --- a/lib/bup/t/tclient.py +++ b/lib/bup/t/tclient.py @@ -1,4 +1,5 @@ +from __future__ import absolute_import import sys, os, stat, time, random, subprocess, glob from wvtest import * diff --git a/lib/bup/t/tgit.py b/lib/bup/t/tgit.py index 3d2e903..dc49330 100644 --- a/lib/bup/t/tgit.py +++ b/lib/bup/t/tgit.py @@ -1,4 +1,5 @@ +from __future__ import absolute_import from subprocess import check_call import struct, os, time diff --git a/lib/bup/t/thashsplit.py b/lib/bup/t/thashsplit.py index 1a95f40..5b99586 100644 --- a/lib/bup/t/thashsplit.py +++ b/lib/bup/t/thashsplit.py @@ -1,3 +1,5 @@ + +from __future__ import absolute_import from io import BytesIO from wvtest import * diff --git a/lib/bup/t/thelpers.py b/lib/bup/t/thelpers.py index c707839..e0ef21f 100644 --- a/lib/bup/t/thelpers.py +++ b/lib/bup/t/thelpers.py @@ -1,4 +1,5 @@ +from __future__ import absolute_import import helpers, math, os, os.path, stat, subprocess from wvtest import * diff --git a/lib/bup/t/tindex.py b/lib/bup/t/tindex.py index 6639e0b..6364d9e 100644 --- a/lib/bup/t/tindex.py +++ b/lib/bup/t/tindex.py @@ -1,4 +1,5 @@ +from __future__ import absolute_import import os, time from wvtest import * diff --git a/lib/bup/t/tmetadata.py b/lib/bup/t/tmetadata.py index 5caaa46..91cb6df 100644 --- a/lib/bup/t/tmetadata.py +++ b/lib/bup/t/tmetadata.py @@ -1,4 +1,5 @@ +from __future__ import absolute_import import errno, glob, grp, pwd, stat, tempfile, subprocess from wvtest import * diff --git a/lib/bup/t/toptions.py b/lib/bup/t/toptions.py index 5b4a6aa..1b60554 100644 --- a/lib/bup/t/toptions.py +++ b/lib/bup/t/toptions.py @@ -1,8 +1,9 @@ -from bup import options +from __future__ import absolute_import from wvtest import * +from bup import options from buptest import no_lingering_errors diff --git a/lib/bup/t/tshquote.py b/lib/bup/t/tshquote.py index 195cc58..f17346d 100644 --- a/lib/bup/t/tshquote.py +++ b/lib/bup/t/tshquote.py @@ -1,4 +1,6 @@ +from __future__ import absolute_import + from wvtest import * from bup import shquote diff --git a/lib/bup/t/tvfs.py b/lib/bup/t/tvfs.py index a8a9be4..0af42fb 100644 --- a/lib/bup/t/tvfs.py +++ b/lib/bup/t/tvfs.py @@ -1,5 +1,5 @@ -from __future__ import print_function +from __future__ import absolute_import, print_function from collections import namedtuple from errno import ELOOP, ENOTDIR from io import BytesIO diff --git a/lib/bup/t/tvint.py b/lib/bup/t/tvint.py index 283e179..51cd91e 100644 --- a/lib/bup/t/tvint.py +++ b/lib/bup/t/tvint.py @@ -1,3 +1,5 @@ + +from __future__ import absolute_import from io import BytesIO from wvtest import * diff --git a/lib/bup/t/txstat.py b/lib/bup/t/txstat.py index 33d4341..64bad2d 100644 --- a/lib/bup/t/txstat.py +++ b/lib/bup/t/txstat.py @@ -1,3 +1,5 @@ + +from __future__ import absolute_import import math, tempfile, subprocess from wvtest import * diff --git a/lib/bup/version.py b/lib/bup/version.py index 23d3921..fe66a91 100644 --- a/lib/bup/version.py +++ b/lib/bup/version.py @@ -1,4 +1,6 @@ +from __future__ import absolute_import + from bup import _release if _release.COMMIT != '$Format:%H$': diff --git a/lib/bup/vfs.py b/lib/bup/vfs.py index a147ff9..d073b73 100644 --- a/lib/bup/vfs.py +++ b/lib/bup/vfs.py @@ -45,7 +45,7 @@ item.coid. """ -from __future__ import print_function +from __future__ import absolute_import, print_function from collections import namedtuple from errno import ELOOP, ENOENT, ENOTDIR from itertools import chain, dropwhile, groupby, izip, tee diff --git a/lib/bup/vint.py b/lib/bup/vint.py index 378234c..70c2dce 100644 --- a/lib/bup/vint.py +++ b/lib/bup/vint.py @@ -5,6 +5,7 @@ # This code is covered under the terms of the GNU Library General # Public License as described in the bup LICENSE file. +from __future__ import absolute_import from io import BytesIO # Variable length integers are encoded as vints -- see jakarta lucene. diff --git a/lib/bup/xstat.py b/lib/bup/xstat.py index f4e5b04..0770202 100644 --- a/lib/bup/xstat.py +++ b/lib/bup/xstat.py @@ -1,4 +1,6 @@ """Enhanced stat operations for bup.""" + +from __future__ import absolute_import import os, sys import stat as pystat from bup import _helpers diff --git a/main.py b/main.py index dc1bec2..edb3ed8 100755 --- a/main.py +++ b/main.py @@ -5,6 +5,7 @@ exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble +from __future__ import absolute_import import errno, re, sys, os, subprocess, signal, getopt from fcntl import F_GETFL, F_SETFL @@ -35,7 +36,7 @@ os.environ['BUP_MAIN_EXE'] = os.path.abspath(exe) os.environ['BUP_RESOURCE_PATH'] = resourcepath -from bup import helpers +from bup import compat, helpers from bup.compat import add_ex_tb, chain_ex, wrap_main from bup.helpers import atoi, columnate, debug1, log, tty_width diff --git a/t/data-size b/t/data-size index d7da545..0c7a4f9 100755 --- a/t/data-size +++ b/t/data-size @@ -5,6 +5,8 @@ exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble +from __future__ import absolute_import + from os.path import getsize, isdir from sys import argv, stderr import os diff --git a/t/hardlink-sets b/t/hardlink-sets index 9dffe14..99ab883 100755 --- a/t/hardlink-sets +++ b/t/hardlink-sets @@ -5,6 +5,8 @@ exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble +from __future__ import absolute_import + import os, stat, sys # Print the full paths of all the files in each hardlink set diff --git a/t/id-other-than b/t/id-other-than index 2c0370f..eb6aead 100755 --- a/t/id-other-than +++ b/t/id-other-than @@ -5,6 +5,8 @@ exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble +from __future__ import absolute_import + import grp import pwd import sys diff --git a/t/mksock b/t/mksock index 6fb19d8..3a580db 100755 --- a/t/mksock +++ b/t/mksock @@ -5,6 +5,8 @@ exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble +from __future__ import absolute_import + import socket, sys s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM, 0) diff --git a/t/ns-timestamp-resolutions b/t/ns-timestamp-resolutions index 0763127..9927bd5 100755 --- a/t/ns-timestamp-resolutions +++ b/t/ns-timestamp-resolutions @@ -5,6 +5,8 @@ exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble +from __future__ import absolute_import + import os, sys argv = sys.argv diff --git a/t/root-status b/t/root-status index 0c43e9d..28e2347 100755 --- a/t/root-status +++ b/t/root-status @@ -5,7 +5,7 @@ exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble -from __future__ import print_function +from __future__ import absolute_import, print_function from sys import stderr import sys diff --git a/t/subtree-hash b/t/subtree-hash index 926303f..9d0fca6 100755 --- a/t/subtree-hash +++ b/t/subtree-hash @@ -5,6 +5,8 @@ exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble +from __future__ import absolute_import + import os, sys argv = sys.argv diff --git a/t/test-ftp b/t/test-ftp index 62c81c1..9431f14 100755 --- a/t/test-ftp +++ b/t/test-ftp @@ -5,7 +5,7 @@ exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble -from __future__ import print_function +from __future__ import absolute_import, print_function from os import environ, chdir, mkdir, symlink, unlink from os.path import abspath, dirname from time import localtime, strftime diff --git a/t/test-prune-older b/t/test-prune-older index 2ec5947..95a2670 100755 --- a/t/test-prune-older +++ b/t/test-prune-older @@ -5,7 +5,7 @@ exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble -from __future__ import print_function +from __future__ import absolute_import, print_function from collections import defaultdict from difflib import unified_diff from itertools import chain, dropwhile, groupby, takewhile diff --git a/t/unknown-owner b/t/unknown-owner index 210c5b3..9ec7e44 100755 --- a/t/unknown-owner +++ b/t/unknown-owner @@ -5,6 +5,8 @@ exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble +from __future__ import absolute_import + import grp import pwd import sys diff --git a/wvtest.py b/wvtest.py index 742534f..2f48ef6 100755 --- a/wvtest.py +++ b/wvtest.py @@ -4,6 +4,7 @@ bup_python="$(dirname "$0")/cmd/bup-python" exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble + # # WvTest: # Copyright (C)2007-2012 Versabanq Innovations Inc. and contributors. @@ -11,6 +12,8 @@ exec "$bup_python" "$0" ${1+"$@"} # See the included file named LICENSE for license information. # You can get wvtest from: http://github.com/apenwarr/wvtest # + +from __future__ import absolute_import import atexit import inspect import os