So we're not pulling access to random other namespaces through helpers
(like errno, subprocess, etc.), and so it's obvious what's coming from
where.
Thanks to Greg Troxel for help evaluating the changes.
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
37 files changed:
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
-import sys, glob, tempfile
+
+import glob, os, sys, tempfile
+
from bup import options, git, bloom
from bup import options, git, bloom
-from bup.helpers import *
+from bup.helpers import (debug1, handle_ctrl_c, log, progress, qprogress,
+ saved_errors)
optspec = """
bup bloom [options...]
optspec = """
bup bloom [options...]
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
+
+import re, stat, sys
+
from bup import options, git, vfs
from bup import options, git, vfs
-from bup.helpers import *
+from bup.helpers import chunkyreader, handle_ctrl_c, log, saved_errors
optspec = """
bup cat-file [--meta|--bupm] /branch/revision/[path]
optspec = """
bup cat-file [--meta|--bupm] /branch/revision/[path]
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
-from bup.helpers import *
+from bup.helpers import log
# end of bup preamble
from os.path import relpath
# end of bup preamble
from os.path import relpath
from bup import options, drecurse
from bup import options, drecurse
-from bup.helpers import *
+from bup.helpers import log, parse_excludes, parse_rx_excludes, saved_errors
+
optspec = """
bup drecurse <path>
optspec = """
bup drecurse <path>
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
import sys, os, glob, subprocess
import sys, os, glob, subprocess
from bup import options, git
from bup import options, git
-from bup.helpers import *
+from bup.helpers import Sha1, chunkyreader, istty2, log, progress
par2_ok = 0
nullf = open('/dev/null')
par2_ok = 0
nullf = open('/dev/null')
try:
quick_verify(base)
except Exception as e:
try:
quick_verify(base)
except Exception as e:
- debug('error: %s\n' % e)
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
import sys, os, stat, fnmatch
import sys, os, stat, fnmatch
from bup import options, git, shquote, vfs, ls
from bup import options, git, shquote, vfs, ls
-from bup.helpers import *
+from bup.helpers import chunkyreader, handle_ctrl_c, log
+
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
from bup import options, git, vfs, xstat
from bup import options, git, vfs, xstat
-from bup.helpers import *
+from bup.helpers import log
+
try:
import fuse
except ImportError:
try:
import fuse
except ImportError:
# end of bup preamble
import sys, stat, time, os, errno, re
# end of bup preamble
import sys, stat, time, os, errno, re
from bup import metadata, options, git, index, drecurse, hlinkdb
from bup import metadata, options, git, index, drecurse, hlinkdb
-from bup.helpers import *
from bup.hashsplit import GIT_MODE_TREE, GIT_MODE_FILE
from bup.hashsplit import GIT_MODE_TREE, GIT_MODE_FILE
+from bup.helpers import (handle_ctrl_c, log, parse_excludes, parse_rx_excludes,
+ progress, qprogress, saved_errors)
+
class IterHelper:
def __init__(self, l):
class IterHelper:
def __init__(self, l):
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
import sys
from bup import git, options, client
import sys
from bup import git, options, client
-from bup.helpers import *
+from bup.helpers import log, saved_errors
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
from bup import git, options, client
from bup import git, options, client
-from bup.helpers import *
+from bup.helpers import linereader, log
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
from bup import git, options
from bup import git, options
-from bup.helpers import *
+from bup.helpers import handle_ctrl_c, log, qprogress, saved_errors
+
optspec = """
bup list-idx [--find=<prefix>] <idxfilenames...>
optspec = """
bup list-idx [--find=<prefix>] <idxfilenames...>
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
from bup import git, vfs, ls
from bup import git, vfs, ls
-from bup.helpers import *
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
from bup import options, git, _helpers
from bup import options, git, _helpers
-from bup.helpers import *
+from bup.helpers import log
POPULATION_OF_EARTH=6.7e9 # as of September, 2010
POPULATION_OF_EARTH=6.7e9 # as of September, 2010
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
import sys, re, struct, time, resource
import sys, re, struct, time, resource
from bup import git, bloom, midx, options, _helpers
from bup import git, bloom, midx, options, _helpers
-from bup.helpers import *
+from bup.helpers import handle_ctrl_c
+
_linux_warned = 0
def linux_memstat():
global _linux_warned
_linux_warned = 0
def linux_memstat():
global _linux_warned
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
-import sys, math, struct, glob, resource
-import tempfile
+
+import glob, math, os, resource, struct, sys, tempfile
+
from bup import options, git, midx, _helpers, xstat
from bup import options, git, midx, _helpers, xstat
-from bup.helpers import *
+from bup.helpers import (Sha1, atomically_replaced_file, debug1, fdatasync,
+ handle_ctrl_c, log, mmap_readwrite, qprogress,
+ saved_errors, unlink)
+
PAGE_SIZE=4096
SHA_PER_PAGE=PAGE_SIZE/20.
PAGE_SIZE=4096
SHA_PER_PAGE=PAGE_SIZE/20.
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
import os, sys, subprocess, struct
import os, sys, subprocess, struct
-from bup.helpers import *
+from bup.helpers import debug1, debug2, mux
+
# Give the subcommand exclusive access to stdin.
orig_stdin = os.dup(0)
# Give the subcommand exclusive access to stdin.
orig_stdin = os.dup(0)
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
import sys, os, struct, getopt, subprocess, signal
import sys, os, struct, getopt, subprocess, signal
from subprocess import PIPE
from bup import options, ssh, path
from subprocess import PIPE
from bup import options, ssh, path
-from bup.helpers import *
+from bup.helpers import DemuxConn, log
+
optspec = """
bup on <hostname> index ...
optspec = """
bup on <hostname> index ...
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
from bup import options, _helpers
from bup import options, _helpers
-from bup.helpers import *
+from bup.helpers import atoi, handle_ctrl_c, log, parse_num
+
optspec = """
bup random [-S seed] <numbytes>
optspec = """
bup random [-S seed] <numbytes>
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
-import copy, errno, sys, stat, re
+
+import copy, errno, os, sys, stat, re
+
from bup import options, git, metadata, vfs
from bup import options, git, metadata, vfs
-from bup.helpers import *
from bup._helpers import write_sparsely
from bup._helpers import write_sparsely
+from bup.helpers import (chunkyreader, handle_ctrl_c, log, mkdirp,
+ parse_rx_excludes, progress, qprogress, saved_errors,
+ should_rx_exclude_path, unlink)
+
optspec = """
bup restore [-C outdir] </branch/revision/path/to/dir ...>
optspec = """
bup restore [-C outdir] </branch/revision/path/to/dir ...>
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
-import sys, stat, time, math
from errno import EACCES
from io import BytesIO
from errno import EACCES
from io import BytesIO
+import os, sys, stat, time, math
from bup import hashsplit, git, options, index, client, metadata, hlinkdb
from bup import hashsplit, git, options, index, client, metadata, hlinkdb
-from bup.helpers import *
from bup.hashsplit import GIT_MODE_TREE, GIT_MODE_FILE, GIT_MODE_SYMLINK
from bup.hashsplit import GIT_MODE_TREE, GIT_MODE_FILE, GIT_MODE_SYMLINK
+from bup.helpers import (add_error, grafted_path_components, handle_ctrl_c,
+ istty2, log, parse_date_or_fatal, parse_num,
+ path_components, progress, qprogress, resolve_parent,
+ saved_errors, stripped_path_components)
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
from bup import options, git
from bup import options, git
-from bup.helpers import *
+from bup.helpers import Conn, debug1, debug2, linereader, log
+
suspended_w = None
dumb_server_mode = False
suspended_w = None
dumb_server_mode = False
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
from bup import hashsplit, git, options, client
from bup import hashsplit, git, options, client
-from bup.helpers import *
+from bup.helpers import (handle_ctrl_c, log, parse_num, qprogress, reprogress,
+ saved_errors)
"""
# end of bup preamble
"""
# end of bup preamble
from bup import git, options
from bup import git, options
-from bup.helpers import *
+from bup.helpers import debug1, handle_ctrl_c, log
# FIXME: review for safe writes.
# FIXME: review for safe writes.
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
exec "$bup_python" "$0" ${1+"$@"}
"""
# end of bup preamble
-import sys, stat, urllib, mimetypes, posixpath, time, webbrowser
-import urllib
+
+import mimetypes, os, posixpath, stat, sys, time, urllib, webbrowser
+
from bup import options, git, vfs
from bup import options, git, vfs
-from bup.helpers import *
+from bup.helpers import debug1, handle_ctrl_c, log, resource_path
+
try:
import tornado.httpserver
import tornado.ioloop
try:
import tornado.httpserver
import tornado.ioloop
log('error: cannot find the python "tornado" module; please install it\n')
sys.exit(1)
log('error: cannot find the python "tornado" module; please install it\n')
sys.exit(1)
Brandon Low <lostlogic@lostlogicx.com> 2011-02-04
"""
Brandon Low <lostlogic@lostlogicx.com> 2011-02-04
"""
-import sys, os, math, mmap
+
+import sys, os, math, mmap, struct
+
-from bup.helpers import *
+from bup.helpers import (debug1, debug2, log, mmap_read, mmap_readwrite,
+ mmap_readwrite_private)
+
BLOOM_VERSION = 2
MAX_BITS_EACH = 32 # Kinda arbitrary, but 4 bytes per entry is pretty big
BLOOM_VERSION = 2
MAX_BITS_EACH = 32 # Kinda arbitrary, but 4 bytes per entry is pretty big
-import re, struct, errno, time, zlib
+
+import errno, os, re, struct, time, zlib
+
-from bup.helpers import *
+from bup.helpers import (Conn, atomically_replaced_file, chunkyreader, debug1,
+ debug2, linereader, mkdirp, progress, qprogress)
+
-from bup.helpers import *
+
+from bup.helpers import should_rx_exclude_path, debug1
import bup.xstat as xstat
import bup.xstat as xstat
try:
O_LARGEFILE = os.O_LARGEFILE
except AttributeError:
try:
O_LARGEFILE = os.O_LARGEFILE
except AttributeError:
bup repositories are in Git format. This library allows us to
interact with the Git data structures.
"""
bup repositories are in Git format. This library allows us to
interact with the Git data structures.
"""
-import os, sys, zlib, time, subprocess, struct, stat, re, tempfile, glob
+
+import errno, os, sys, zlib, time, subprocess, struct, stat, re, tempfile, glob
from collections import namedtuple
from itertools import islice
from collections import namedtuple
from itertools import islice
-from bup.helpers import *
from bup import _helpers, path, midx, bloom, xstat
from bup import _helpers, path, midx, bloom, xstat
+from bup.helpers import (Sha1, add_error, chunkyreader, debug1, debug2,
+ hostname, log, merge_iter, mmap_read, mmap_readwrite,
+ progress, qprogress, unlink, username, userfullname,
+ utc_offset_str)
+
max_pack_size = 1000*1000*1000 # larger packs will slow down pruning
max_pack_objects = 200*1000 # cache memory usage is about 83 bytes per object
max_pack_size = 1000*1000*1000 # larger packs will slow down pruning
max_pack_objects = 200*1000 # cache memory usage is about 83 bytes per object
-import metadata, os, stat, struct, tempfile
+import errno, metadata, os, stat, struct, tempfile
+
-from bup.helpers import *
+from bup.helpers import (add_error, log, merge_iter, mmap_readwrite,
+ progress, qprogress, resolve_parent, slashappend)
+
EMPTY_SHA = '\0'*20
FAKE_SHA = '\x01'*20
EMPTY_SHA = '\0'*20
FAKE_SHA = '\x01'*20
"""Common code for listing files from a bup repository."""
"""Common code for listing files from a bup repository."""
import copy, os.path, stat, xstat
import copy, os.path, stat, xstat
from bup import metadata, options, vfs
from bup import metadata, options, vfs
+from helpers import istty1, log
-from bup.helpers import *
+from bup.helpers import log, mmap_read
+
-import errno, platform, tempfile
+
+import errno, platform, subprocess, tempfile
+
-from bup.helpers import *
+from bup.helpers import mkdirp
+
bup_tmp = os.path.realpath('../../../t/tmp')
mkdirp(bup_tmp)
bup_tmp = os.path.realpath('../../../t/tmp')
mkdirp(bup_tmp)
-import struct, os, tempfile, time
from subprocess import check_call
from subprocess import check_call
+import struct, os, subprocess, tempfile, time
+
-from bup.helpers import *
+from bup.helpers import log, mkdirp, readpipe
+
import os.path
import tempfile
import stat
import os.path
import tempfile
import stat
+import subprocess
+
+from bup.helpers import (atomically_replaced_file, batchpipe, detect_fakeroot,
+ grafted_path_components, mkdirp, parse_num,
+ path_components, readpipe, stripped_path_components,
+ utc_offset_str)
import bup._helpers as _helpers
import bup._helpers as _helpers
-from bup.helpers import *
bup_tmp = os.path.realpath('../../../t/tmp')
mkdirp(bup_tmp)
bup_tmp = os.path.realpath('../../../t/tmp')
mkdirp(bup_tmp)
-import os
-import time, tempfile
+
+import os, subprocess, time, tempfile
from bup import index, metadata
from bup import index, metadata
-from bup.helpers import *
-import bup.helpers as helpers
+from bup.helpers import mkdirp, resolve_parent
import bup.xstat as xstat
from wvtest import *
import bup.xstat as xstat
from wvtest import *
lib_t_dir = os.getcwd()
bup_tmp = os.path.realpath('../../../t/tmp')
mkdirp(bup_tmp)
lib_t_dir = os.getcwd()
bup_tmp = os.path.realpath('../../../t/tmp')
mkdirp(bup_tmp)
cd = os.path.realpath('../../../t')
WVPASS(cd)
sd = os.path.realpath(cd + '/sampledata')
cd = os.path.realpath('../../../t')
WVPASS(cd)
sd = os.path.realpath(cd + '/sampledata')
- WVPASSEQ(helpers.resolve_parent(cd + '/sampledata'), sd)
+ WVPASSEQ(resolve_parent(cd + '/sampledata'), sd)
WVPASSEQ(os.path.realpath(cd + '/sampledata/x'), sd + '/x')
WVPASSEQ(os.path.realpath(cd + '/sampledata/var/abs-symlink'),
sd + '/var/abs-symlink-target')
WVPASSEQ(os.path.realpath(cd + '/sampledata/x'), sd + '/x')
WVPASSEQ(os.path.realpath(cd + '/sampledata/var/abs-symlink'),
sd + '/var/abs-symlink-target')
- WVPASSEQ(helpers.resolve_parent(cd + '/sampledata/var/abs-symlink'),
+ WVPASSEQ(resolve_parent(cd + '/sampledata/var/abs-symlink'),
The vfs.py library makes it possible to expose contents from bup's repository
and abstracts internal name mangling and storage from the exposition layer.
"""
The vfs.py library makes it possible to expose contents from bup's repository
and abstracts internal name mangling and storage from the exposition layer.
"""
import os, re, stat, time
import os, re, stat, time
from bup import git, metadata
from bup import git, metadata
+from helpers import debug1, debug2
from bup.git import BUP_NORMAL, BUP_CHUNKED, cp
from bup.hashsplit import GIT_MODE_TREE, GIT_MODE_FILE
from bup.git import BUP_NORMAL, BUP_CHUNKED, cp
from bup.hashsplit import GIT_MODE_TREE, GIT_MODE_FILE
import sys, os, subprocess, signal, getopt
import sys, os, subprocess, signal, getopt
argv = sys.argv
exe = os.path.realpath(argv[0])
exepath = os.path.split(exe)[0] or '.'
argv = sys.argv
exe = os.path.realpath(argv[0])
exepath = os.path.split(exe)[0] or '.'
os.environ['BUP_MAIN_EXE'] = os.path.abspath(exe)
os.environ['BUP_RESOURCE_PATH'] = resourcepath
os.environ['BUP_MAIN_EXE'] = os.path.abspath(exe)
os.environ['BUP_RESOURCE_PATH'] = resourcepath
-from bup.helpers import *
+from bup.helpers import atoi, columnate, debug1, log, tty_width
+
# after running 'bup newliner', the tty_width() ioctl won't work anymore
os.environ['WIDTH'] = str(tty_width())
# after running 'bup newliner', the tty_width() ioctl won't work anymore
os.environ['WIDTH'] = str(tty_width())