--- /dev/null
+# -*-conf-*-
+
+[MESSAGES CONTROL]
+disable=all
+enable=unused-import,unused-wildcard-import
maybe_specific_n = $(if $(filter -j%,$(parallel_opt)),-n$(get_parallel_n))
xdist_opt = $(if $(filter -j,$(parallel_opt)),-nauto,$(maybe_specific_n))
-test: all test/tmp dev/python
+lint: dev/bup-python
+ ./pylint
+
+test: all test/tmp dev/python lint
if test yes = "$$(dev/python -c 'import xdist; print("yes")' 2>/dev/null)"; then \
(set -x; ./pytest $(xdist_opt);) \
else \
"""
from __future__ import absolute_import
-import sys, os, math, mmap, struct
+import os, math, struct
from bup import _helpers
from bup.helpers import (debug1, debug2, log, mmap_read, mmap_readwrite,
from __future__ import absolute_import
from binascii import hexlify, unhexlify
-import errno, os, re, struct, sys, time, zlib
+import errno, os, re, struct, time, zlib
import socket
from bup import git, ssh, vfs
debug2, linereader, lines_until_sentinel,
mkdirp, progress, qprogress, DemuxConn)
from bup.io import path_msg
-from bup.vint import read_bvec, read_vuint, write_bvec
+from bup.vint import write_bvec
bwlimit = None
import os, glob, sys
-from bup import compat, options, git, bloom
+from bup import options, git, bloom
from bup.compat import argv_bytes, hexstr
-from bup.helpers import (add_error, debug1, handle_ctrl_c, log, progress, qprogress,
+from bup.helpers import (add_error, debug1, log, progress, qprogress,
saved_errors)
from bup.io import path_msg
from bup import options, git, vfs
from bup.compat import argv_bytes
-from bup.helpers import chunkyreader, handle_ctrl_c, log, saved_errors
+from bup.helpers import chunkyreader, log, saved_errors
from bup.io import byte_stream
from bup.repo import LocalRepo
from __future__ import absolute_import
-import fcntl, getopt, os, socket, subprocess, sys
+import fcntl, getopt, os, socket, subprocess, sys, select
from bup import options, path
-from bup.helpers import *
+from bup.helpers import log, debug1
optspec = """
from __future__ import absolute_import
-import os, random, sys
+import os, random
from bup import options
from bup.compat import argv_bytes, bytes_from_uint, range
from __future__ import absolute_import, print_function
from shutil import rmtree
-from subprocess import PIPE, Popen
+from subprocess import PIPE
from tempfile import mkdtemp
from binascii import hexlify
import glob, os, subprocess, sys
import os, fnmatch, stat, sys
from bup import _helpers, options, git, shquote, ls, vfs
-from bup.compat import argv_bytes, fsdecode
-from bup.helpers import chunkyreader, handle_ctrl_c, log
+from bup.compat import argv_bytes
+from bup.helpers import chunkyreader, log
from bup.io import byte_stream, path_msg
from bup.repo import LocalRepo
sys.exit(2)
from bup import options, git, vfs, xstat
-from bup.compat import argv_bytes, fsdecode, py_maj
+from bup.compat import argv_bytes, fsdecode
from bup.helpers import log
from bup.repo import LocalRepo
from bup import git, options
from bup.gc import bup_gc
-from bup.helpers import die_if_errors, handle_ctrl_c, log
+from bup.helpers import die_if_errors
optspec = """
from __future__ import absolute_import, print_function
from binascii import hexlify, unhexlify
from collections import namedtuple
-from functools import partial
from stat import S_ISDIR
import os, sys, textwrap, time
-from bup import compat, git, client, helpers, vfs
+from bup import compat, git, client, vfs
from bup.compat import (
argv_bytes,
bytes_from_byte,
environ,
hexstr,
items,
- wrap_main
)
from bup.git import get_cat_data, parse_commit, walk_object
-from bup.helpers import add_error, debug1, handle_ctrl_c, log, saved_errors
-from bup.helpers import hostname, shstr, tty_width
+from bup.helpers import add_error, debug1, log, saved_errors
+from bup.helpers import hostname, tty_width
from bup.io import path_msg
from bup.pwdgrp import userfullname, username
from bup.repo import LocalRepo, RemoteRepo
from __future__ import absolute_import
from calendar import timegm
-from pipes import quote
from subprocess import check_call
-from time import strftime, strptime
+from time import strptime
import os, sys, tempfile
from bup import git, helpers, options
-from bup.compat import argv_bytes, str_type
-from bup.helpers import (handle_ctrl_c,
- log,
- readpipe,
+from bup.compat import argv_bytes
+from bup.helpers import (log,
shstr,
- saved_errors,
- unlink)
+ saved_errors)
import bup.path
from binascii import hexlify
import errno, os, stat, sys, time
-from bup import compat, metadata, options, git, index, drecurse, hlinkdb
+from bup import metadata, options, git, index, hlinkdb
from bup.compat import argv_bytes
from bup.drecurse import recursive_dirlist
-from bup.hashsplit import GIT_MODE_TREE, GIT_MODE_FILE
+from bup.hashsplit import GIT_MODE_FILE
from bup.helpers import (add_error, handle_ctrl_c, log, parse_excludes, parse_rx_excludes,
progress, qprogress, saved_errors)
from bup.io import byte_stream, path_msg
import sys
from bup import git, options, client
-from bup.helpers import log, saved_errors
+from bup.helpers import log
from bup.compat import argv_bytes
from __future__ import absolute_import, print_function
from binascii import hexlify, unhexlify
-import os, sys
+import sys
from bup import git, options
from bup.compat import argv_bytes
from __future__ import absolute_import, print_function
-import os.path, sys
+import sys
-from bup import compat, git, ls
+from bup import git, ls
from bup.io import byte_stream
def main(argv):
from bup import git, bloom, midx, options, _helpers
from bup.compat import range
-from bup.helpers import handle_ctrl_c
from bup.io import byte_stream
from __future__ import absolute_import
import sys
-from bup import compat, metadata
+from bup import metadata
from bup import options
from bup.compat import argv_bytes
from bup.io import byte_stream
-from bup.helpers import handle_ctrl_c, log, saved_errors
+from bup.helpers import log, saved_errors
def open_input(name):
from __future__ import absolute_import, print_function
from binascii import hexlify
-import glob, os, math, resource, struct, sys, tempfile
+import glob, os, math, resource, struct, sys
from bup import options, git, midx, _helpers, xstat
from bup.compat import argv_bytes, hexstr, range
from bup.helpers import (Sha1, add_error, atomically_replaced_file, debug1, fdatasync,
- handle_ctrl_c, log, mmap_readwrite, qprogress,
+ log, mmap_readwrite, qprogress,
saved_errors, unlink)
from bup.io import byte_stream, path_msg
from __future__ import absolute_import
-import os, struct, subprocess, sys
+import os, subprocess, sys
from bup import options
from bup.helpers import debug1, debug2, mux
import os, struct, sys
from bup import options, helpers, path
-from bup.compat import environ, py_maj
+from bup.compat import environ
from bup.io import byte_stream
optspec = """
from binascii import hexlify, unhexlify
from collections import defaultdict
from itertools import groupby
-from sys import stderr
from time import localtime, strftime, time
import sys
from stat import S_ISDIR
import copy, errno, os, re, stat, sys
-from bup import options, git, metadata, vfs
+from bup import options, git, vfs
from bup._helpers import write_sparsely
-from bup.compat import argv_bytes, fsencode, wrap_main
-from bup.helpers import (add_error, chunkyreader, die_if_errors, handle_ctrl_c,
- log, mkdirp, parse_rx_excludes, progress, qprogress,
- saved_errors, should_rx_exclude_path, unlink)
+from bup.compat import argv_bytes, fsencode
+from bup.helpers import (add_error, chunkyreader, die_if_errors,
+ mkdirp, parse_rx_excludes, progress, qprogress,
+ should_rx_exclude_path)
from bup.io import byte_stream
from bup.repo import LocalRepo, RemoteRepo
from bup.compat import argv_bytes
from bup.git import check_repo_or_die
from bup.options import Options
-from bup.helpers import die_if_errors, handle_ctrl_c, log
+from bup.helpers import die_if_errors
from bup.repo import LocalRepo
from bup.rm import bup_rm
from bup import options, git, vfs, vint
from bup.compat import environ, hexstr
-from bup.git import MissingObject
from bup.helpers import (Conn, debug1, debug2, linereader, lines_until_sentinel,
log)
from bup.io import byte_stream, path_msg
from bup import compat, hashsplit, git, options, client
from bup.compat import argv_bytes, environ
-from bup.helpers import (add_error, handle_ctrl_c, hostname, log, parse_num,
+from bup.helpers import (add_error, hostname, log, parse_num,
qprogress, reprogress, saved_errors,
valid_save_name,
parse_date_or_fatal)
from __future__ import absolute_import
from binascii import hexlify
-import os, sys
+import sys
from bup import git, options
from bup.compat import argv_bytes
-from bup.helpers import debug1, handle_ctrl_c, log
+from bup.helpers import debug1, log
from bup.io import byte_stream, path_msg
from __future__ import absolute_import
-import os, sys, time
+import time
from bup import options
from __future__ import absolute_import, print_function
import re, sys
-from bup import compat, options, version
+from bup import options, version
from bup.io import byte_stream
version_rx = re.compile(r'^[0-9]+\.[0-9]+(\.[0-9]+)?(-[0-9]+-g[0-9abcdef]+)?$')
from __future__ import absolute_import, print_function
from collections import namedtuple
-import mimetypes, os, posixpath, signal, stat, sys, time, urllib, webbrowser
+import mimetypes, os, posixpath, signal, stat, sys, time, webbrowser
from binascii import hexlify
from bup import options, git, vfs
-from bup.helpers import (chunkyreader, debug1, format_filesize, handle_ctrl_c,
+from bup.helpers import (chunkyreader, debug1, format_filesize,
log, saved_errors)
-from bup.metadata import Metadata
from bup.path import resource_path
from bup.repo import LocalRepo
from bup.io import path_msg
from __future__ import absolute_import, print_function
-import errno, stat, sys
+import errno, sys
-from bup import compat, metadata, options, xstat
+from bup import metadata, options
from bup.compat import argv_bytes
-from bup.helpers import add_error, handle_ctrl_c, parse_timestamp, saved_errors, \
+from bup.helpers import add_error, parse_timestamp, saved_errors, \
add_error, log
from bup.io import byte_stream
from __future__ import absolute_import, print_function
-from array import array
from binascii import hexlify
from traceback import print_exception
import os, sys
if py3:
+ # pylint: disable=unused-import
from os import environb as environ
from os import fsdecode, fsencode
from shlex import quote
return x
from pipes import quote
+ # pylint: disable=unused-import
from os import environ, getcwd
+ # pylint: disable=unused-import
from bup.py2raise import reraise
input = raw_input
import glob, os, subprocess, sys, tempfile
from bup import bloom, git, midx
-from bup.compat import hexstr, pending_raise, range
+from bup.compat import hexstr, pending_raise
from bup.git import MissingObject, walk_object
from bup.helpers import Nonlocal, log, progress, qprogress
from bup.io import path_msg
"""
from __future__ import absolute_import, print_function
-import errno, os, sys, zlib, time, subprocess, struct, stat, re, tempfile, glob
+import os, sys, zlib, subprocess, struct, stat, re, tempfile, glob
from array import array
from binascii import hexlify, unhexlify
from collections import namedtuple
from itertools import islice
-from numbers import Integral
-from bup import _helpers, compat, hashsplit, path, midx, bloom, xstat
+from bup import _helpers, hashsplit, path, midx, bloom, xstat
from bup.compat import (buffer,
byte_int, bytes_from_byte, bytes_from_uint,
environ,
from bup.helpers import (Sha1, add_error, chunkyreader, debug1, debug2,
exo,
fdatasync,
- hostname, localtime, log,
+ log,
merge_dict,
merge_iter,
mmap_read, mmap_readwrite,
- parse_num,
progress, qprogress, stat_if_exists,
unlink,
utc_offset_str)
-from bup.pwdgrp import username, userfullname
verbose = 0
from __future__ import absolute_import
import io, math, os
-from bup import _helpers, compat, helpers
+from bup import _helpers, helpers
from bup._helpers import cat_bytes
-from bup.compat import buffer, py_maj
+from bup.compat import buffer
from bup.helpers import sc_page_size
from math import floor
from os import environ
from subprocess import PIPE, Popen
-import sys, os, pwd, subprocess, errno, socket, select, mmap, stat, re, struct
-import hashlib, heapq, math, operator, time, grp, tempfile
+import sys, os, subprocess, errno, select, mmap, stat, re, struct
+import hashlib, heapq, math, operator, time, tempfile
from bup import _helpers
from bup import compat
from __future__ import absolute_import, print_function
import errno, os, stat, struct, tempfile
-from bup import compat, metadata, xstat
+from bup import metadata, xstat
from bup._helpers import UINT_MAX, bytescmp
from bup.compat import range
from bup.helpers import (add_error, log, merge_iter, mmap_readwrite,
from __future__ import absolute_import
from binascii import hexlify
from itertools import chain
-from stat import S_ISDIR, S_ISLNK
-import copy, locale, os.path, stat, sys
+from stat import S_ISDIR
+import os.path
import posixpath
-from bup import metadata, options, vfs, xstat
+from bup import metadata, vfs, xstat
from bup.compat import argv_bytes
from bup.io import path_msg
from bup.options import Options
from bup.repo import LocalRepo, RemoteRepo
-from bup.helpers import columnate, istty1, last, log
+from bup.helpers import columnate, istty1, log
def item_hash(item, tree_for_commit):
"""If the item is a Commit, return its commit oid, otherwise return
from pkgutil import iter_modules
from subprocess import PIPE
from threading import Thread
-import errno, re, select, signal, subprocess
+import re, select, signal, subprocess
from bup import compat, path, helpers
from bup.compat import (
ModuleNotFoundError,
add_ex_ctx,
add_ex_tb,
- argv_bytes,
environ,
fsdecode,
int_types,
wrap_main
)
-from bup.compat import add_ex_tb, add_ex_ctx, argv_bytes, wrap_main
+from bup.compat import add_ex_tb, add_ex_ctx, wrap_main
from bup.helpers import (
columnate,
- debug1,
handle_ctrl_c,
log,
merge_dict,
# Public License as described in the bup LICENSE file.
from __future__ import absolute_import, print_function
-from binascii import hexlify
from copy import deepcopy
from errno import EACCES, EINVAL, ENOTTY, ENOSYS, EOPNOTSUPP
from io import BytesIO
from time import gmtime, strftime
-import errno, os, sys, stat, time, pwd, grp, socket, struct
+import errno, os, sys, stat, time, socket, struct
-from bup import compat, vint, xstat
-from bup.compat import py_maj
+from bup import vint, xstat
from bup.drecurse import recursive_dirlist
from bup.helpers import add_error, mkdirp, log, is_superuser, format_filesize
from bup.io import path_msg
from __future__ import absolute_import, print_function
-import glob, mmap, os, struct
+import glob, os, struct
from bup import _helpers
from bup.compat import range
from __future__ import absolute_import, print_function
-import os, pwd, grp
+import os
from bup import _helpers
from bup.helpers import cache_key_value
from __future__ import absolute_import
from binascii import hexlify, unhexlify
-import sys
from bup import compat, git, vfs
from bup.client import ClientError
-from bup.compat import add_ex_ctx, add_ex_tb, hexstr, pending_raise
+from bup.compat import hexstr, pending_raise
from bup.git import get_commit_items
from bup.helpers import add_error, die_if_errors, log, saved_errors
from bup.io import path_msg
from __future__ import absolute_import, print_function
import sys, os, re, subprocess
-from bup import helpers, path
+from bup import path
from bup.compat import environ
def connect(rhost, port, subcmd, stderr=None):
from __future__ import absolute_import, print_function
-from bup.hashsplit import GIT_MODE_TREE, GIT_MODE_FILE, GIT_MODE_SYMLINK
-
class TreeItem:
__slots__ = 'name', 'mode', 'gitmode', 'oid', 'meta'
from __future__ import absolute_import, print_function
-import sys
from bup.compat import ModuleNotFoundError
from __future__ import absolute_import, print_function
from binascii import hexlify, unhexlify
from collections import namedtuple
-from errno import EINVAL, ELOOP, ENOENT, ENOTDIR
-from itertools import chain, dropwhile, groupby, tee
+from errno import EINVAL, ELOOP, ENOTDIR
+from itertools import chain, groupby, tee
from random import randrange
from stat import S_IFDIR, S_IFLNK, S_IFREG, S_ISDIR, S_ISLNK, S_ISREG
from time import localtime, strftime
import re, sys
-from bup import git, metadata, vint
+from bup import git, vint
from bup.compat import hexstr, range
-from bup.git import BUP_CHUNKED, cp, get_commit_items, parse_commit, tree_decode
+from bup.git import BUP_CHUNKED, parse_commit, tree_decode
from bup.helpers import debug2, last
from bup.io import path_msg
from bup.metadata import Metadata
from __future__ import absolute_import
from io import BytesIO
-import sys
from bup import compat
from bup import _helpers
--- /dev/null
+#!/bin/sh
+
+# Changes here might also be appropriate for ./pytest
+
+set -eu
+
+script_home="$(cd "$(dirname "$0")" && pwd -P)"
+testlibdir="$script_home/test/lib"
+
+export PYTHONPATH="$testlibdir${PYTHONPATH:+:$PYTHONPATH}"
+
+if test "$#" -eq 0; then
+ set -x
+ dev/bup-python -m pylint lib
+ # unused-wildcard-import: we always "import * from wvpytest"
+ dev/bup-python -m pylint -d unused-wildcard-import test/lib test/int
+else
+ set -x
+ exec dev/bup-python -m pylint "$@"
+fi
#!/bin/sh
+# Changes here might also be appropriate for ./pylint
+
set -eu
script_home="$(cd "$(dirname "$0")" && pwd -P)"
import logging
from bup import bloom
-from bup.helpers import mkdirp
def test_bloom(tmpdir):
hashes = [os.urandom(20) for i in range(100)]
from __future__ import absolute_import
-import sys, os, stat, time, random, subprocess, glob
+import os, time, random, subprocess, glob
import pytest
from bup import client, git, path
from bup.compat import bytes_from_uint, environ, range
-from bup.helpers import mkdirp
def randbytes(sz):
s = b''
from binascii import hexlify, unhexlify
from subprocess import check_call
from functools import partial
-import struct, os, time
+import struct, os
import pytest
from wvpytest import *
from __future__ import absolute_import
from time import tzset
-import math, os, os.path, re, subprocess
+import os, os.path, re
from bup import helpers
from wvpytest import *
from bup.compat import bytes_from_byte, bytes_from_uint, environ
from bup.helpers import (atomically_replaced_file, batchpipe, detect_fakeroot,
- grafted_path_components, mkdirp, parse_num,
+ grafted_path_components, parse_num,
path_components, readpipe, stripped_path_components,
shstr,
utc_offset_str)
-import bup._helpers as _helpers
def test_parse_num():
from bup import index, metadata
from bup.compat import fsencode
-from bup.helpers import mkdirp, resolve_parent
+from bup.helpers import resolve_parent
import bup.xstat as xstat
from __future__ import absolute_import, print_function
-import errno, glob, grp, pwd, stat, tempfile, subprocess
+import errno, glob, stat, subprocess
import os, sys
import pytest
WVEXCEPT(Exception, dir_m.create_path, path, create_symlinks=True)
-from bup.metadata import read_acl
-
from bup.metadata import xattr
if xattr:
def remove_selinux(attrs):
from errno import ELOOP, ENOTDIR
from os import symlink
from stat import S_IFDIR
-from sys import stderr
import os
from time import localtime, strftime
from bup import git, path, vfs
from bup.compat import environ
-from bup.io import path_msg
-from bup.metadata import Metadata
from bup.repo import LocalRepo, RemoteRepo
from buptest import ex, exo
from buptest.vfs import tree_dict
from __future__ import absolute_import, print_function
from binascii import unhexlify
-from collections import namedtuple
-from errno import ELOOP, ENOTDIR
from io import BytesIO
from os import symlink
from random import Random, randint
from bup._helpers import write_random
from bup import git, metadata, vfs
from bup.compat import environ, fsencode, items, range
-from bup.git import BUP_CHUNKED
from bup.helpers import exc, shstr
from bup.metadata import Metadata
from bup.repo import LocalRepo
from __future__ import absolute_import
-import math, tempfile, subprocess
from wvpytest import *