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 <module>
from bup import metadata, options, git, index, drecurse, hlinkdb
File "/home/rlb/src/bup/main-4/lib/bup/metadata.py", line 10, in <module>
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 <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
85 files changed:
-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
from collections import namedtuple
from contextlib import contextmanager
from os.path import basename, dirname, realpath
"""
# end of bup preamble
"""
# end of bup preamble
+from __future__ import absolute_import
import glob, os, sys, tempfile
from bup import options, git, bloom
import glob, os, sys, tempfile
from bup import options, git, bloom
"""
# end of bup preamble
"""
# end of bup preamble
+from __future__ import absolute_import
import re, stat, sys
from bup import options, git, vfs
import re, stat, sys
from bup import options, git, vfs
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
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 *
import sys, getopt, socket, subprocess, fcntl
from bup import options, path
from bup.helpers import *
"""
# end of bup preamble
"""
# end of bup preamble
+from __future__ import absolute_import
import sys, os, random
from bup import options
import sys, os, random
from bup import options
"""
# end of bup preamble
"""
# end of bup preamble
+from __future__ import absolute_import
from os.path import relpath
import sys
from os.path import relpath
import sys
"""
# end of bup preamble
"""
# end of bup preamble
+from __future__ import absolute_import
import sys, os, glob, subprocess
from bup import options, git
import sys, os, glob, subprocess
from bup import options, git
"""
# end of bup preamble
"""
# end of bup preamble
+from __future__ import absolute_import
import sys, os, stat, fnmatch
from bup import options, git, shquote, ls, vfs
import sys, os, stat, fnmatch
from bup import options, git, shquote, ls, vfs
"""
# end of bup preamble
"""
# end of bup preamble
+from __future__ import absolute_import
import sys, os, errno
try:
import sys, os, errno
try:
"""
# end of bup preamble
"""
# end of bup preamble
+from __future__ import absolute_import
import sys
from bup import git, options
import sys
from bup import git, options
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
+
+from __future__ import absolute_import
import sys, os, glob
from bup import options, path
import sys, os, glob
from bup import options, path
"""
# end of bup preamble
"""
# end of bup preamble
+from __future__ import absolute_import
from calendar import timegm
from pipes import quote
from subprocess import check_call
from calendar import timegm
from pipes import quote
from subprocess import check_call
"""
# end of bup preamble
"""
# 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
import sys, stat, time, os, errno, re
from bup import metadata, options, git, index, drecurse, hlinkdb
"""
# end of bup preamble
"""
# end of bup preamble
+from __future__ import absolute_import
import sys
from bup import git, options, client
import sys
from bup import git, options, client
"""
# end of bup preamble
"""
# end of bup preamble
+from __future__ import absolute_import
import sys
from bup import git, options
import sys
from bup import git, options
"""
# end of bup preamble
"""
# end of bup preamble
+from __future__ import absolute_import
import sys, os
from bup import git, options
import sys, os
from bup import git, options
"""
# end of bup preamble
"""
# end of bup preamble
+from __future__ import absolute_import
import sys
from bup import git, ls
import sys
from bup import git, ls
"""
# end of bup preamble
"""
# end of bup preamble
+from __future__ import absolute_import
import sys, struct, math
from bup import options, git, _helpers
import sys, struct, math
from bup import options, git, _helpers
"""
# end of bup preamble
"""
# end of bup preamble
+from __future__ import absolute_import
import sys, re, struct, time, resource
from bup import git, bloom, midx, options, _helpers
import sys, re, struct, time, resource
from bup import git, bloom, midx, options, _helpers
# TODO: Add tar-like -C option.
# TODO: Add tar-like -C option.
+from __future__ import absolute_import
import sys
from bup import metadata
from bup import options
import sys
from bup import metadata
from bup import options
"""
# end of bup preamble
"""
# 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
import glob, math, os, resource, struct, sys, tempfile
from bup import options, git, midx, _helpers, xstat
"""
# end of bup preamble
"""
# end of bup preamble
+from __future__ import absolute_import
import os, sys, subprocess, struct
from bup import options
import os, sys, subprocess, struct
from bup import options
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
+
+from __future__ import absolute_import
import sys, os, struct
from bup import options, helpers
import sys, os, struct
from bup import options, helpers
"""
# end of bup preamble
"""
# end of bup preamble
+from __future__ import absolute_import
import sys, os, struct, getopt, subprocess, signal
from subprocess import PIPE
import sys, os, struct, getopt, subprocess, signal
from subprocess import PIPE
"""
# end of bup preamble
"""
# 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
from collections import defaultdict
from itertools import groupby
from sys import stderr
"""
# end of bup preamble
"""
# end of bup preamble
+from __future__ import absolute_import
import os, sys
from bup import options, _helpers
import os, sys
from bup import options, _helpers
"""
# end of bup preamble
"""
# 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
from stat import S_ISDIR
import copy, errno, os, sys, stat, re
"""
# end of bup preamble
"""
# end of bup preamble
+from __future__ import absolute_import
import sys
from bup.git import check_repo_or_die
import sys
from bup.git import check_repo_or_die
"""
# end of bup preamble
"""
# end of bup preamble
+from __future__ import absolute_import
from errno import EACCES
from io import BytesIO
import os, sys, stat, time, math
from errno import EACCES
from io import BytesIO
import os, sys, stat, time, math
"""
# end of bup preamble
"""
# end of bup preamble
+from __future__ import absolute_import
import os, sys, struct, subprocess
from bup import options, git
import os, sys, struct, subprocess
from bup import options, git
"""
# end of bup preamble
"""
# end of bup preamble
+from __future__ import absolute_import
import os, sys, time
from bup import hashsplit, git, options, client
import os, sys, time
from bup import hashsplit, git, options, client
"""
# end of bup preamble
"""
# end of bup preamble
+from __future__ import absolute_import
import os, sys
from bup import git, options
import os, sys
from bup import git, options
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
+
+from __future__ import absolute_import
import sys, time
from bup import options
import sys, time
from bup import options
"""
# end of bup preamble
"""
# end of bup preamble
-from __future__ import print_function
+from __future__ import absolute_import, print_function
import re, sys
from bup import options
import re, sys
from bup import options
"""
# end of bup preamble
"""
# 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
from collections import namedtuple
import mimetypes, os, posixpath, signal, stat, sys, time, urllib, webbrowser
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
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.
# 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
from bup import metadata, options, xstat
from bup.helpers import add_error, handle_ctrl_c, parse_timestamp, saved_errors, \
add_error, log
from bup import metadata, options, xstat
from bup.helpers import add_error, handle_ctrl_c, parse_timestamp, saved_errors, \
add_error, log
Brandon Low <lostlogic@lostlogicx.com> 2011-02-04
"""
Brandon Low <lostlogic@lostlogicx.com> 2011-02-04
"""
+from __future__ import absolute_import
import sys, os, math, mmap, struct
from bup import _helpers
import sys, os, math, mmap, struct
from bup import _helpers
+from __future__ import absolute_import
import errno, os, re, struct, sys, time, zlib
from bup import git, ssh
import errno, os, re, struct, sys, time, zlib
from bup import git, ssh
-from __future__ import print_function
+from __future__ import absolute_import, print_function
from traceback import print_exception
import sys
from traceback import print_exception
import sys
+
+from __future__ import absolute_import
+
from distutils.core import setup, Extension
_helpers_mod = Extension('_helpers',
from distutils.core import setup, Extension
_helpers_mod = Extension('_helpers',
+from __future__ import absolute_import
import stat, os
from bup.helpers import add_error, should_rx_exclude_path, debug1, resolve_parent
import stat, os
from bup.helpers import add_error, should_rx_exclude_path, debug1, resolve_parent
+
+from __future__ import absolute_import
import glob, os, subprocess, sys, tempfile
from bup import bloom, git, midx
from bup.git import MissingObject, walk_object
import glob, os, subprocess, sys, tempfile
from bup import bloom, git, midx
from bup.git import MissingObject, walk_object
interact with the Git data structures.
"""
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
import errno, os, sys, zlib, time, subprocess, struct, stat, re, tempfile, glob
from collections import namedtuple
from itertools import islice
+
+from __future__ import absolute_import
import io, math, os
from bup import _helpers, helpers
import io, math, os
from bup import _helpers, helpers
"""Helper functions and classes for bup."""
"""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
from collections import namedtuple
from contextlib import contextmanager
from ctypes import sizeof, c_void_p
+
+from __future__ import absolute_import
import cPickle, errno, os, tempfile
from bup import compat
import cPickle, errno, os, tempfile
from bup import compat
-import errno, metadata, os, stat, struct, tempfile
+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)
from bup._helpers import UINT_MAX, bytescmp
from bup.helpers import (add_error, log, merge_iter, mmap_readwrite,
progress, qprogress, resolve_parent, slashappend)
"""Common code for listing files from a bup repository."""
"""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
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 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
def item_hash(item, tree_for_commit):
"""If the item is a Commit, return its commit oid, otherwise return
# This code is covered under the terms of the GNU Library General
# Public License as described in the bup LICENSE file.
# 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
from copy import deepcopy
from errno import EACCES, EINVAL, ENOTTY, ENOSYS, EOPNOTSUPP
from io import BytesIO
+from __future__ import absolute_import
import glob, mmap, os, struct
from bup import _helpers
import glob, mmap, os, struct
from bup import _helpers
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.
"""
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:
import sys, os, textwrap, getopt, re, struct
try:
"""This is a separate module so we can cleanly getcwd() before anyone
does chdir().
"""
"""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()
import sys, os
startdir = os.getcwd()
+from __future__ import absolute_import
from functools import partial
from bup import client, git
from functools import partial
from bup import client, git
+from __future__ import absolute_import
import sys
from bup import compat, git, vfs
import sys
from bup import compat, git, vfs
+
+from __future__ import absolute_import
"""SSH connection.
Connect to a remote host via SSH and execute a command on the host.
"""
"""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
import sys, os, re, subprocess
from bup import helpers, path
+
+from __future__ import absolute_import
+from __future__ import absolute_import
import errno, platform, tempfile
from wvtest import *
import errno, platform, tempfile
from wvtest import *
+from __future__ import absolute_import
import sys, os, stat, time, random, subprocess, glob
from wvtest import *
import sys, os, stat, time, random, subprocess, glob
from wvtest import *
+from __future__ import absolute_import
from subprocess import check_call
import struct, os, time
from subprocess import check_call
import struct, os, time
+
+from __future__ import absolute_import
from io import BytesIO
from wvtest import *
from io import BytesIO
from wvtest import *
+from __future__ import absolute_import
import helpers, math, os, os.path, stat, subprocess
from wvtest import *
import helpers, math, os, os.path, stat, subprocess
from wvtest import *
+from __future__ import absolute_import
import os, time
from wvtest import *
import os, time
from wvtest import *
+from __future__ import absolute_import
import errno, glob, grp, pwd, stat, tempfile, subprocess
from wvtest import *
import errno, glob, grp, pwd, stat, tempfile, subprocess
from wvtest import *
+from __future__ import absolute_import
from buptest import no_lingering_errors
from buptest import no_lingering_errors
+from __future__ import absolute_import
+
from wvtest import *
from bup import shquote
from wvtest import *
from bup import shquote
-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
from collections import namedtuple
from errno import ELOOP, ENOTDIR
from io import BytesIO
+
+from __future__ import absolute_import
from io import BytesIO
from wvtest import *
from io import BytesIO
from wvtest import *
+
+from __future__ import absolute_import
import math, tempfile, subprocess
from wvtest import *
import math, tempfile, subprocess
from wvtest import *
+from __future__ import absolute_import
+
from bup import _release
if _release.COMMIT != '$Format:%H$':
from bup import _release
if _release.COMMIT != '$Format:%H$':
-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
from collections import namedtuple
from errno import ELOOP, ENOENT, ENOTDIR
from itertools import chain, dropwhile, groupby, izip, tee
# This code is covered under the terms of the GNU Library General
# Public License as described in the bup LICENSE file.
# 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.
from io import BytesIO
# Variable length integers are encoded as vints -- see jakarta lucene.
"""Enhanced stat operations for bup."""
"""Enhanced stat operations for bup."""
+
+from __future__ import absolute_import
import os, sys
import stat as pystat
from bup import _helpers
import os, sys
import stat as pystat
from bup import _helpers
"""
# end of bup preamble
"""
# end of bup preamble
+from __future__ import absolute_import
import errno, re, sys, os, subprocess, signal, getopt
from fcntl import F_GETFL, F_SETFL
import errno, re, sys, os, subprocess, signal, getopt
from fcntl import F_GETFL, F_SETFL
os.environ['BUP_RESOURCE_PATH'] = resourcepath
os.environ['BUP_RESOURCE_PATH'] = resourcepath
+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
from bup.compat import add_ex_tb, chain_ex, wrap_main
from bup.helpers import atoi, columnate, debug1, log, tty_width
"""
# end of bup preamble
"""
# end of bup preamble
+from __future__ import absolute_import
+
from os.path import getsize, isdir
from sys import argv, stderr
import os
from os.path import getsize, isdir
from sys import argv, stderr
import os
"""
# end of bup preamble
"""
# 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
import os, stat, sys
# Print the full paths of all the files in each hardlink set
"""
# end of bup preamble
"""
# end of bup preamble
+from __future__ import absolute_import
+
import grp
import pwd
import sys
import grp
import pwd
import sys
"""
# end of bup preamble
"""
# end of bup preamble
+from __future__ import absolute_import
+
import socket, sys
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM, 0)
import socket, sys
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM, 0)
"""
# end of bup preamble
"""
# end of bup preamble
+from __future__ import absolute_import
+
import os, sys
argv = sys.argv
import os, sys
argv = sys.argv
"""
# end of bup preamble
"""
# end of bup preamble
-from __future__ import print_function
+from __future__ import absolute_import, print_function
from sys import stderr
import sys
from sys import stderr
import sys
"""
# end of bup preamble
"""
# end of bup preamble
+from __future__ import absolute_import
+
import os, sys
argv = sys.argv
import os, sys
argv = sys.argv
"""
# end of bup preamble
"""
# 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
from os import environ, chdir, mkdir, symlink, unlink
from os.path import abspath, dirname
from time import localtime, strftime
"""
# end of bup preamble
"""
# 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
from collections import defaultdict
from difflib import unified_diff
from itertools import chain, dropwhile, groupby, takewhile
"""
# end of bup preamble
"""
# end of bup preamble
+from __future__ import absolute_import
+
import grp
import pwd
import sys
import grp
import pwd
import sys
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
#
# WvTest:
# Copyright (C)2007-2012 Versabanq Innovations Inc. and contributors.
#
# WvTest:
# Copyright (C)2007-2012 Versabanq Innovations Inc. and contributors.
# See the included file named LICENSE for license information.
# You can get wvtest from: http://github.com/apenwarr/wvtest
#
# 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
import atexit
import inspect
import os