Dan Kenigsberg has uploaded a new change for review. Change subject: force absolute imports where we can ......................................................................
force absolute imports where we can Implicit relative imports are confusing, as explained in https://www.python.org/dev/peps/pep-0328/. They have been dropped from Python 3, too. Unfortunately, we still use them extensively, but our lib and vdsm/network directories are almost free of them. This patch drops a single occurrence and makes sure that we do not happen to add new implicit relative imports by mistake under thess directories. Future patches would extend the white list until Vdsm is free of them. Change-Id: Ibb3aed51c37b846c928fc2d443c9f848dcba5d7c Signed-off-by: Dan Kenigsberg <[email protected]> --- M Makefile.am M lib/vdsm/__init__.py M lib/vdsm/cmdutils.py M lib/vdsm/compat.py M lib/vdsm/concurrent.py M lib/vdsm/config.py.in M lib/vdsm/constants.py.in M lib/vdsm/define.py M lib/vdsm/exception.py M lib/vdsm/executor.py M lib/vdsm/infra/__init__.py M lib/vdsm/infra/eventfd/__init__.py M lib/vdsm/infra/eventfd/tests.py M lib/vdsm/infra/filecontrol/__init__.py M lib/vdsm/infra/filecontrol/tests.py M lib/vdsm/infra/sigutils/__init__.py M lib/vdsm/infra/sigutils/tests.py M lib/vdsm/infra/sigutils/tests_child.py M lib/vdsm/infra/zombiereaper/__init__.py M lib/vdsm/infra/zombiereaper/tests.py M lib/vdsm/ipwrapper.py M lib/vdsm/libvirtconnection.py M lib/vdsm/netconfpersistence.py M lib/vdsm/netinfo.py M lib/vdsm/netlink/__init__.py M lib/vdsm/netlink/addr.py M lib/vdsm/netlink/link.py M lib/vdsm/netlink/monitor.py M lib/vdsm/netlink/route.py M lib/vdsm/password.py M lib/vdsm/profiling/__init__.py M lib/vdsm/profiling/cpu.py M lib/vdsm/profiling/errors.py M lib/vdsm/profiling/memory.py M lib/vdsm/profiling/profile.py M lib/vdsm/pthread.py M lib/vdsm/qemuimg.py M lib/vdsm/response.py M lib/vdsm/schedule.py M lib/vdsm/sslutils.py M lib/vdsm/sysctl.py M lib/vdsm/tool/__init__.py M lib/vdsm/tool/configfile.py M lib/vdsm/tool/configurator.py M lib/vdsm/tool/configurators/__init__.py M lib/vdsm/tool/configurators/certificates.py M lib/vdsm/tool/configurators/libvirt.py M lib/vdsm/tool/configurators/multipath.py M lib/vdsm/tool/configurators/passwd.py M lib/vdsm/tool/configurators/sanlock.py M lib/vdsm/tool/configurators/sebool.py M lib/vdsm/tool/dummybr.py M lib/vdsm/tool/dump_bonding_defaults.py M lib/vdsm/tool/dump_volume_chains.py M lib/vdsm/tool/load_needed_modules.py.in M lib/vdsm/tool/nwfilter.py M lib/vdsm/tool/register.py M lib/vdsm/tool/restore_nets.py M lib/vdsm/tool/service.py M lib/vdsm/tool/transient.py M lib/vdsm/tool/unified_persistence.py M lib/vdsm/tool/upgrade.py M lib/vdsm/tool/validate_ovirt_certs.py.in M lib/vdsm/tool/vdsm-id.py M lib/vdsm/udevadm.py M lib/vdsm/utils.py M lib/vdsm/vdscli.py M lib/vdsm/virtsparsify.py M lib/vdsm/xmlrpc.py M lib/yajsonrpc/__init__.py M lib/yajsonrpc/betterAsyncore.py M lib/yajsonrpc/stomp.py M lib/yajsonrpc/stompreactor.py M vdsm/network/__init__.py M vdsm/network/api.py M vdsm/network/configurators/__init__.py M vdsm/network/configurators/dhclient.py M vdsm/network/configurators/ifcfg.py M vdsm/network/configurators/iproute2.py M vdsm/network/configurators/libvirt.py M vdsm/network/configurators/pyroute_two.py M vdsm/network/configurators/qos.py M vdsm/network/errors.py M vdsm/network/models.py M vdsm/network/sourceroute.py M vdsm/network/sourceroutethread.py M vdsm/network/tc/__init__.py M vdsm/network/tc/_parser.py M vdsm/network/tc/_wrapper.py M vdsm/network/tc/cls.py M vdsm/network/tc/filter.py M vdsm/network/tc/qdisc.py 92 files changed, 105 insertions(+), 3 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/45/42045/1 diff --git a/Makefile.am b/Makefile.am index 743d0a9..1a8d1c2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -78,6 +78,11 @@ vdsm.py \ $(NULL) +ABS_IMPORT_WHITELIST = \ + lib + vdsm/network + $(NULL) + WHITELIST = \ contrib/logdb \ contrib/profile-stats \ @@ -104,6 +109,12 @@ done; \ fi; +.PHONY: abs_imports +abs_imports: + @for f in `git ls-files $(ABS_IMPORT_WHITELIST) |grep '.py$$\|.py.in$$'`; do\ + if ! grep -q '^from __future__ import absolute_import$$' "$$f"; then \ + echo "Missing absolute_import in $$f"; exit 1; fi; \ + done; SKIP_PYFLAKES_ERR = "\./vdsm/storage/lvm\.py.*: list comprehension redefines \ 'lv' from line .*" diff --git a/lib/vdsm/__init__.py b/lib/vdsm/__init__.py index 14f91a1..b006497 100644 --- a/lib/vdsm/__init__.py +++ b/lib/vdsm/__init__.py @@ -17,3 +17,4 @@ # # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import diff --git a/lib/vdsm/cmdutils.py b/lib/vdsm/cmdutils.py index 07178ac..5dc53d4 100644 --- a/lib/vdsm/cmdutils.py +++ b/lib/vdsm/cmdutils.py @@ -18,6 +18,7 @@ # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import import os import re diff --git a/lib/vdsm/compat.py b/lib/vdsm/compat.py index 9b5561e..8ac5201 100644 --- a/lib/vdsm/compat.py +++ b/lib/vdsm/compat.py @@ -18,6 +18,7 @@ # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import try: import cPickle as pickle pickle # make pyflakes happy diff --git a/lib/vdsm/concurrent.py b/lib/vdsm/concurrent.py index 64e072d..3865873 100644 --- a/lib/vdsm/concurrent.py +++ b/lib/vdsm/concurrent.py @@ -18,6 +18,7 @@ # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import import threading from collections import namedtuple diff --git a/lib/vdsm/config.py.in b/lib/vdsm/config.py.in index 03a63c8..994019f 100644 --- a/lib/vdsm/config.py.in +++ b/lib/vdsm/config.py.in @@ -18,6 +18,7 @@ # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import import os import textwrap import ConfigParser diff --git a/lib/vdsm/constants.py.in b/lib/vdsm/constants.py.in index 2890f3e..7889f0e 100644 --- a/lib/vdsm/constants.py.in +++ b/lib/vdsm/constants.py.in @@ -20,6 +20,7 @@ # # Description: Constants definitions for vdsm and utilities. +from __future__ import absolute_import import os # VDSM management networks diff --git a/lib/vdsm/define.py b/lib/vdsm/define.py index 147e2b8..cfd4eb1 100644 --- a/lib/vdsm/define.py +++ b/lib/vdsm/define.py @@ -18,6 +18,7 @@ # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import errCode = { 'noVM': {'status': { 'code': 1, diff --git a/lib/vdsm/exception.py b/lib/vdsm/exception.py index 6c484b5..35d9e92 100644 --- a/lib/vdsm/exception.py +++ b/lib/vdsm/exception.py @@ -17,6 +17,7 @@ # # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import class VdsmException(Exception): diff --git a/lib/vdsm/executor.py b/lib/vdsm/executor.py index fc7880e..335e2a5 100644 --- a/lib/vdsm/executor.py +++ b/lib/vdsm/executor.py @@ -18,6 +18,7 @@ # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import """Threaded based executor. Blocked tasks may be discarded, and the worker pool is automatically replenished.""" diff --git a/lib/vdsm/infra/__init__.py b/lib/vdsm/infra/__init__.py index 40502d1..4676596 100644 --- a/lib/vdsm/infra/__init__.py +++ b/lib/vdsm/infra/__init__.py @@ -17,6 +17,7 @@ # # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import __all__ = [ "eventfd", "filecontrol", diff --git a/lib/vdsm/infra/eventfd/__init__.py b/lib/vdsm/infra/eventfd/__init__.py index 5f83974..bc12341 100644 --- a/lib/vdsm/infra/eventfd/__init__.py +++ b/lib/vdsm/infra/eventfd/__init__.py @@ -17,6 +17,7 @@ # # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import """ This is a module to implement a python wrapper for eventfd(2). diff --git a/lib/vdsm/infra/eventfd/tests.py b/lib/vdsm/infra/eventfd/tests.py index 842f05e..6d45b85 100644 --- a/lib/vdsm/infra/eventfd/tests.py +++ b/lib/vdsm/infra/eventfd/tests.py @@ -17,6 +17,7 @@ # # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import import fcntl from .. import eventfd from nose import tools diff --git a/lib/vdsm/infra/filecontrol/__init__.py b/lib/vdsm/infra/filecontrol/__init__.py index 35c65c2..d15258a 100644 --- a/lib/vdsm/infra/filecontrol/__init__.py +++ b/lib/vdsm/infra/filecontrol/__init__.py @@ -17,6 +17,7 @@ # # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import import fcntl import os diff --git a/lib/vdsm/infra/filecontrol/tests.py b/lib/vdsm/infra/filecontrol/tests.py index de1dad6..3025983 100644 --- a/lib/vdsm/infra/filecontrol/tests.py +++ b/lib/vdsm/infra/filecontrol/tests.py @@ -1,3 +1,4 @@ +from __future__ import absolute_import import fcntl import functools import os diff --git a/lib/vdsm/infra/sigutils/__init__.py b/lib/vdsm/infra/sigutils/__init__.py index 5fc8a63..2fed224 100644 --- a/lib/vdsm/infra/sigutils/__init__.py +++ b/lib/vdsm/infra/sigutils/__init__.py @@ -18,6 +18,7 @@ # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import import errno import os import select diff --git a/lib/vdsm/infra/sigutils/tests.py b/lib/vdsm/infra/sigutils/tests.py index ac60c41..79c9ca4 100644 --- a/lib/vdsm/infra/sigutils/tests.py +++ b/lib/vdsm/infra/sigutils/tests.py @@ -18,6 +18,7 @@ # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import import contextlib import errno import os diff --git a/lib/vdsm/infra/sigutils/tests_child.py b/lib/vdsm/infra/sigutils/tests_child.py index e703198..ec42036 100755 --- a/lib/vdsm/infra/sigutils/tests_child.py +++ b/lib/vdsm/infra/sigutils/tests_child.py @@ -18,6 +18,7 @@ # # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import import functools import signal import subprocess diff --git a/lib/vdsm/infra/zombiereaper/__init__.py b/lib/vdsm/infra/zombiereaper/__init__.py index edc2afe..4dfb38e 100644 --- a/lib/vdsm/infra/zombiereaper/__init__.py +++ b/lib/vdsm/infra/zombiereaper/__init__.py @@ -17,6 +17,7 @@ # # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import """ ZombieReaper is a module to handle the annoying problem of cleaning up child processes. Specifically, for cases where the result of the child process is not diff --git a/lib/vdsm/infra/zombiereaper/tests.py b/lib/vdsm/infra/zombiereaper/tests.py index 6f1983f..681579f 100644 --- a/lib/vdsm/infra/zombiereaper/tests.py +++ b/lib/vdsm/infra/zombiereaper/tests.py @@ -17,6 +17,7 @@ # # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import from time import sleep import os diff --git a/lib/vdsm/ipwrapper.py b/lib/vdsm/ipwrapper.py index 2b7d455..175a9c9 100644 --- a/lib/vdsm/ipwrapper.py +++ b/lib/vdsm/ipwrapper.py @@ -17,6 +17,7 @@ # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import from contextlib import closing from glob import iglob import array diff --git a/lib/vdsm/libvirtconnection.py b/lib/vdsm/libvirtconnection.py index 4f7dad6..109c9c1 100644 --- a/lib/vdsm/libvirtconnection.py +++ b/lib/vdsm/libvirtconnection.py @@ -18,6 +18,7 @@ # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import import atexit import threading import functools diff --git a/lib/vdsm/netconfpersistence.py b/lib/vdsm/netconfpersistence.py index 26534eb..fc616b8 100644 --- a/lib/vdsm/netconfpersistence.py +++ b/lib/vdsm/netconfpersistence.py @@ -18,6 +18,7 @@ # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import import errno import json import logging diff --git a/lib/vdsm/netinfo.py b/lib/vdsm/netinfo.py index fc08104..5e5d638 100644 --- a/lib/vdsm/netinfo.py +++ b/lib/vdsm/netinfo.py @@ -18,6 +18,7 @@ # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import from collections import defaultdict import errno from glob import iglob diff --git a/lib/vdsm/netlink/__init__.py b/lib/vdsm/netlink/__init__.py index 1fb3110..013e35c 100644 --- a/lib/vdsm/netlink/__init__.py +++ b/lib/vdsm/netlink/__init__.py @@ -17,6 +17,7 @@ # # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import from contextlib import contextmanager from ctypes import (CDLL, CFUNCTYPE, c_char, c_char_p, c_int, c_void_p, c_size_t, get_errno, py_object, sizeof) diff --git a/lib/vdsm/netlink/addr.py b/lib/vdsm/netlink/addr.py index 97a68c8..a9b212a 100644 --- a/lib/vdsm/netlink/addr.py +++ b/lib/vdsm/netlink/addr.py @@ -16,6 +16,7 @@ # # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import from ctypes import (CFUNCTYPE, byref, c_char, c_int, c_void_p, sizeof) from functools import partial import errno diff --git a/lib/vdsm/netlink/link.py b/lib/vdsm/netlink/link.py index 8ce0ce5..10d7807 100644 --- a/lib/vdsm/netlink/link.py +++ b/lib/vdsm/netlink/link.py @@ -16,6 +16,7 @@ # # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import from contextlib import contextmanager from ctypes import (CFUNCTYPE, byref, c_char, c_char_p, c_int, c_void_p, c_size_t, sizeof) diff --git a/lib/vdsm/netlink/monitor.py b/lib/vdsm/netlink/monitor.py index 3ebfe51..0cb45ce 100644 --- a/lib/vdsm/netlink/monitor.py +++ b/lib/vdsm/netlink/monitor.py @@ -16,6 +16,7 @@ # # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import from contextlib import closing, contextmanager from ctypes import CFUNCTYPE, c_int, c_void_p, py_object import Queue diff --git a/lib/vdsm/netlink/route.py b/lib/vdsm/netlink/route.py index c262fc6..3a173db 100644 --- a/lib/vdsm/netlink/route.py +++ b/lib/vdsm/netlink/route.py @@ -16,6 +16,7 @@ # # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import from ctypes import CFUNCTYPE, c_int, c_void_p, byref from functools import partial from socket import AF_UNSPEC diff --git a/lib/vdsm/password.py b/lib/vdsm/password.py index f3f8b6e..52588b1 100644 --- a/lib/vdsm/password.py +++ b/lib/vdsm/password.py @@ -17,6 +17,7 @@ # # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import class ProtectedPassword(object): diff --git a/lib/vdsm/profiling/__init__.py b/lib/vdsm/profiling/__init__.py index ff21495..400b376 100644 --- a/lib/vdsm/profiling/__init__.py +++ b/lib/vdsm/profiling/__init__.py @@ -17,3 +17,4 @@ # # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import diff --git a/lib/vdsm/profiling/cpu.py b/lib/vdsm/profiling/cpu.py index fe13f60..47f0ecd 100644 --- a/lib/vdsm/profiling/cpu.py +++ b/lib/vdsm/profiling/cpu.py @@ -18,6 +18,7 @@ # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import """ This module provides cpu profiling. """ diff --git a/lib/vdsm/profiling/errors.py b/lib/vdsm/profiling/errors.py index 200438b..0a74260 100644 --- a/lib/vdsm/profiling/errors.py +++ b/lib/vdsm/profiling/errors.py @@ -18,6 +18,7 @@ # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import """ This module provides exceptions for the profiling package. """ diff --git a/lib/vdsm/profiling/memory.py b/lib/vdsm/profiling/memory.py index 0af3be1..31f833c 100755 --- a/lib/vdsm/profiling/memory.py +++ b/lib/vdsm/profiling/memory.py @@ -18,6 +18,7 @@ # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import """ This module provides memory profiling. """ diff --git a/lib/vdsm/profiling/profile.py b/lib/vdsm/profiling/profile.py index 1bfe326..562fe07 100644 --- a/lib/vdsm/profiling/profile.py +++ b/lib/vdsm/profiling/profile.py @@ -18,6 +18,7 @@ # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import """ profiling facade. """ diff --git a/lib/vdsm/pthread.py b/lib/vdsm/pthread.py index dc532cc..851afd1 100644 --- a/lib/vdsm/pthread.py +++ b/lib/vdsm/pthread.py @@ -18,6 +18,7 @@ # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import import ctypes import logging import threading diff --git a/lib/vdsm/qemuimg.py b/lib/vdsm/qemuimg.py index 9549b2b..78a19ca 100644 --- a/lib/vdsm/qemuimg.py +++ b/lib/vdsm/qemuimg.py @@ -18,6 +18,7 @@ # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import import os import re import signal diff --git a/lib/vdsm/response.py b/lib/vdsm/response.py index b30209f..758fde8 100644 --- a/lib/vdsm/response.py +++ b/lib/vdsm/response.py @@ -19,6 +19,7 @@ # +from __future__ import absolute_import from vdsm.define import doneCode from vdsm.define import errCode diff --git a/lib/vdsm/schedule.py b/lib/vdsm/schedule.py index 92fcc83..05386c7 100644 --- a/lib/vdsm/schedule.py +++ b/lib/vdsm/schedule.py @@ -18,6 +18,7 @@ # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import """ This module provides a Scheduler class scheduling execution of a callable on a background thread. diff --git a/lib/vdsm/sslutils.py b/lib/vdsm/sslutils.py index 68722a3..bcf845e 100644 --- a/lib/vdsm/sslutils.py +++ b/lib/vdsm/sslutils.py @@ -17,6 +17,7 @@ # # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import import httplib import logging import socket diff --git a/lib/vdsm/sysctl.py b/lib/vdsm/sysctl.py index 9f2583b..af25041 100644 --- a/lib/vdsm/sysctl.py +++ b/lib/vdsm/sysctl.py @@ -19,6 +19,7 @@ # +from __future__ import absolute_import _RPFILTER_STRICT = '1' _RPFILTER_LOOSE = '2' diff --git a/lib/vdsm/tool/__init__.py b/lib/vdsm/tool/__init__.py index 0fe1901..bd3a31d 100644 --- a/lib/vdsm/tool/__init__.py +++ b/lib/vdsm/tool/__init__.py @@ -16,6 +16,7 @@ # # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import import functools import os diff --git a/lib/vdsm/tool/configfile.py b/lib/vdsm/tool/configfile.py index 294d81b..26ec114 100644 --- a/lib/vdsm/tool/configfile.py +++ b/lib/vdsm/tool/configfile.py @@ -17,6 +17,7 @@ # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import import ConfigParser import functools import os diff --git a/lib/vdsm/tool/configurator.py b/lib/vdsm/tool/configurator.py index 37c4eb4..5ed905d 100644 --- a/lib/vdsm/tool/configurator.py +++ b/lib/vdsm/tool/configurator.py @@ -16,6 +16,7 @@ # # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import """I handle vdsm's configuration life cycle. This is achieved by utilizing modules from configurators package to: diff --git a/lib/vdsm/tool/configurators/__init__.py b/lib/vdsm/tool/configurators/__init__.py index 973894e..c59bcaf 100644 --- a/lib/vdsm/tool/configurators/__init__.py +++ b/lib/vdsm/tool/configurators/__init__.py @@ -18,6 +18,7 @@ # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import from .. import UsageError diff --git a/lib/vdsm/tool/configurators/certificates.py b/lib/vdsm/tool/configurators/certificates.py index fd361e5..4433c7b 100644 --- a/lib/vdsm/tool/configurators/certificates.py +++ b/lib/vdsm/tool/configurators/certificates.py @@ -16,6 +16,7 @@ # # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import import os import sys diff --git a/lib/vdsm/tool/configurators/libvirt.py b/lib/vdsm/tool/configurators/libvirt.py index e182231..e0c6352 100644 --- a/lib/vdsm/tool/configurators/libvirt.py +++ b/lib/vdsm/tool/configurators/libvirt.py @@ -16,6 +16,7 @@ # # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import import errno import filecmp import os diff --git a/lib/vdsm/tool/configurators/multipath.py b/lib/vdsm/tool/configurators/multipath.py index 56e3874..19f3842 100644 --- a/lib/vdsm/tool/configurators/multipath.py +++ b/lib/vdsm/tool/configurators/multipath.py @@ -17,6 +17,7 @@ # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import import os import shutil import sys diff --git a/lib/vdsm/tool/configurators/passwd.py b/lib/vdsm/tool/configurators/passwd.py index 9e734d8..fc0cfc0 100644 --- a/lib/vdsm/tool/configurators/passwd.py +++ b/lib/vdsm/tool/configurators/passwd.py @@ -17,6 +17,7 @@ # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import from ... import constants from ... import utils diff --git a/lib/vdsm/tool/configurators/sanlock.py b/lib/vdsm/tool/configurators/sanlock.py index 2a831b9..71e8a93 100644 --- a/lib/vdsm/tool/configurators/sanlock.py +++ b/lib/vdsm/tool/configurators/sanlock.py @@ -16,6 +16,7 @@ # # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import import os import sys import grp diff --git a/lib/vdsm/tool/configurators/sebool.py b/lib/vdsm/tool/configurators/sebool.py index 2f361b3..51e4b09 100644 --- a/lib/vdsm/tool/configurators/sebool.py +++ b/lib/vdsm/tool/configurators/sebool.py @@ -17,6 +17,7 @@ # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import from .import \ YES, \ NO, \ diff --git a/lib/vdsm/tool/dummybr.py b/lib/vdsm/tool/dummybr.py index a04d981..e17f6ab 100644 --- a/lib/vdsm/tool/dummybr.py +++ b/lib/vdsm/tool/dummybr.py @@ -19,6 +19,7 @@ # +from __future__ import absolute_import import os from ..netinfo import DUMMY_BRIDGE diff --git a/lib/vdsm/tool/dump_bonding_defaults.py b/lib/vdsm/tool/dump_bonding_defaults.py index ba55fb3..262717a 100644 --- a/lib/vdsm/tool/dump_bonding_defaults.py +++ b/lib/vdsm/tool/dump_bonding_defaults.py @@ -18,6 +18,7 @@ # +from __future__ import absolute_import import json from ..netinfo import BONDING_MASTERS, BONDING_OPT, BONDING_DEFAULTS, bondOpts diff --git a/lib/vdsm/tool/dump_volume_chains.py b/lib/vdsm/tool/dump_volume_chains.py index 25dd34f..16c960a 100644 --- a/lib/vdsm/tool/dump_volume_chains.py +++ b/lib/vdsm/tool/dump_volume_chains.py @@ -16,6 +16,7 @@ # # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import from __future__ import print_function from collections import defaultdict import errno diff --git a/lib/vdsm/tool/load_needed_modules.py.in b/lib/vdsm/tool/load_needed_modules.py.in index b68e8b3..dc7d533 100644 --- a/lib/vdsm/tool/load_needed_modules.py.in +++ b/lib/vdsm/tool/load_needed_modules.py.in @@ -19,6 +19,7 @@ # +from __future__ import absolute_import import os.path from . import expose, ExtraArgsError diff --git a/lib/vdsm/tool/nwfilter.py b/lib/vdsm/tool/nwfilter.py index 1b7537c..91d7866 100755 --- a/lib/vdsm/tool/nwfilter.py +++ b/lib/vdsm/tool/nwfilter.py @@ -19,6 +19,7 @@ # +from __future__ import absolute_import import logging import libvirt diff --git a/lib/vdsm/tool/register.py b/lib/vdsm/tool/register.py index 7cbac33..3ac3fc6 100644 --- a/lib/vdsm/tool/register.py +++ b/lib/vdsm/tool/register.py @@ -14,6 +14,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA. A copy of the GNU General Public License is # also available at http://www.gnu.org/copyleft/gpl.html. +from __future__ import absolute_import import argparse import getpass import hashlib diff --git a/lib/vdsm/tool/restore_nets.py b/lib/vdsm/tool/restore_nets.py index ba4256e..38e4ae9 100644 --- a/lib/vdsm/tool/restore_nets.py +++ b/lib/vdsm/tool/restore_nets.py @@ -17,6 +17,7 @@ # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import import os import sys diff --git a/lib/vdsm/tool/service.py b/lib/vdsm/tool/service.py index d2703b2..f51054a 100644 --- a/lib/vdsm/tool/service.py +++ b/lib/vdsm/tool/service.py @@ -17,6 +17,7 @@ # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import ''' System service management utlities. ''' diff --git a/lib/vdsm/tool/transient.py b/lib/vdsm/tool/transient.py index 5c36895..13accb6 100644 --- a/lib/vdsm/tool/transient.py +++ b/lib/vdsm/tool/transient.py @@ -17,6 +17,7 @@ # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import import os import glob import pwd diff --git a/lib/vdsm/tool/unified_persistence.py b/lib/vdsm/tool/unified_persistence.py index 0a617ce..22262a9 100644 --- a/lib/vdsm/tool/unified_persistence.py +++ b/lib/vdsm/tool/unified_persistence.py @@ -16,6 +16,7 @@ # # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import import errno import logging diff --git a/lib/vdsm/tool/upgrade.py b/lib/vdsm/tool/upgrade.py index 8447745..4bc904c 100644 --- a/lib/vdsm/tool/upgrade.py +++ b/lib/vdsm/tool/upgrade.py @@ -17,6 +17,7 @@ # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import import argparse import logging import logging.config diff --git a/lib/vdsm/tool/validate_ovirt_certs.py.in b/lib/vdsm/tool/validate_ovirt_certs.py.in index 5ac9474..13b38b2 100644 --- a/lib/vdsm/tool/validate_ovirt_certs.py.in +++ b/lib/vdsm/tool/validate_ovirt_certs.py.in @@ -17,6 +17,7 @@ # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import import os import pwd import shutil diff --git a/lib/vdsm/tool/vdsm-id.py b/lib/vdsm/tool/vdsm-id.py index 6dcf6f9..379b926 100644 --- a/lib/vdsm/tool/vdsm-id.py +++ b/lib/vdsm/tool/vdsm-id.py @@ -17,6 +17,7 @@ # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import from ..utils import getHostUUID from . import expose, ExtraArgsError import sys diff --git a/lib/vdsm/udevadm.py b/lib/vdsm/udevadm.py index fc3d71c..2e9bdc2 100644 --- a/lib/vdsm/udevadm.py +++ b/lib/vdsm/udevadm.py @@ -18,6 +18,7 @@ # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import import logging from . import utils diff --git a/lib/vdsm/utils.py b/lib/vdsm/utils.py index e4e7be1..df9a781 100644 --- a/lib/vdsm/utils.py +++ b/lib/vdsm/utils.py @@ -18,6 +18,7 @@ # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import """ A module containing miscellaneous functions and classes that are used plentifuly around vdsm. diff --git a/lib/vdsm/vdscli.py b/lib/vdsm/vdscli.py index 3673a8b..e0c7a13 100644 --- a/lib/vdsm/vdscli.py +++ b/lib/vdsm/vdscli.py @@ -19,6 +19,7 @@ # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import from __future__ import print_function import xmlrpclib import os diff --git a/lib/vdsm/virtsparsify.py b/lib/vdsm/virtsparsify.py index dd1cfdd..1399167 100644 --- a/lib/vdsm/virtsparsify.py +++ b/lib/vdsm/virtsparsify.py @@ -18,6 +18,7 @@ # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import import signal from . import utils diff --git a/lib/vdsm/xmlrpc.py b/lib/vdsm/xmlrpc.py index 6837d63..b98282b 100644 --- a/lib/vdsm/xmlrpc.py +++ b/lib/vdsm/xmlrpc.py @@ -18,6 +18,7 @@ # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import from Queue import Queue from SimpleXMLRPCServer import SimpleXMLRPCDispatcher from SimpleXMLRPCServer import SimpleXMLRPCRequestHandler diff --git a/lib/yajsonrpc/__init__.py b/lib/yajsonrpc/__init__.py index e4120c4..8522246 100644 --- a/lib/yajsonrpc/__init__.py +++ b/lib/yajsonrpc/__init__.py @@ -12,6 +12,7 @@ # You should have received a copy of the GNU General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +from __future__ import absolute_import import logging from functools import partial from Queue import Queue diff --git a/lib/yajsonrpc/betterAsyncore.py b/lib/yajsonrpc/betterAsyncore.py index 8ada555..50e8c75 100644 --- a/lib/yajsonrpc/betterAsyncore.py +++ b/lib/yajsonrpc/betterAsyncore.py @@ -16,6 +16,7 @@ # Asyncore uses inheritance all around which makes it not flexible enought for # us to use. This does tries to reuse enought code from the original asyncore # while enabling compositing instead of inheritance. +from __future__ import absolute_import import asyncore import socket from errno import EWOULDBLOCK diff --git a/lib/yajsonrpc/stomp.py b/lib/yajsonrpc/stomp.py index dfe33fd..f18ea75 100644 --- a/lib/yajsonrpc/stomp.py +++ b/lib/yajsonrpc/stomp.py @@ -13,6 +13,7 @@ # License along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +from __future__ import absolute_import import logging import socket from uuid import uuid4 diff --git a/lib/yajsonrpc/stompreactor.py b/lib/yajsonrpc/stompreactor.py index 91f205f..3b138a3 100644 --- a/lib/yajsonrpc/stompreactor.py +++ b/lib/yajsonrpc/stompreactor.py @@ -13,17 +13,18 @@ # License along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +from __future__ import absolute_import import logging from collections import deque, defaultdict from uuid import uuid4 import functools -import stomp from vdsm import utils from vdsm.compat import json -from betterAsyncore import Dispatcher, Reactor from vdsm.sslutils import SSLSocket -from yajsonrpc import JsonRpcClient +from . import JsonRpcClient +from . import stomp +from .betterAsyncore import Dispatcher, Reactor _STATE_LEN = "Waiting for message length" _STATE_MSG = "Waiting for message" diff --git a/vdsm/network/__init__.py b/vdsm/network/__init__.py index 3dd8a33..8a892b8 100644 --- a/vdsm/network/__init__.py +++ b/vdsm/network/__init__.py @@ -16,3 +16,4 @@ # # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import diff --git a/vdsm/network/api.py b/vdsm/network/api.py index 0483d00..7aa3568 100755 --- a/vdsm/network/api.py +++ b/vdsm/network/api.py @@ -17,6 +17,7 @@ # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import from __future__ import print_function from functools import wraps import errno diff --git a/vdsm/network/configurators/__init__.py b/vdsm/network/configurators/__init__.py index 39679c5..de9771a 100644 --- a/vdsm/network/configurators/__init__.py +++ b/vdsm/network/configurators/__init__.py @@ -17,6 +17,7 @@ # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import import ConfigParser import logging diff --git a/vdsm/network/configurators/dhclient.py b/vdsm/network/configurators/dhclient.py index 4dcb0a2..67f7eba 100644 --- a/vdsm/network/configurators/dhclient.py +++ b/vdsm/network/configurators/dhclient.py @@ -18,6 +18,7 @@ # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import import errno import logging import os diff --git a/vdsm/network/configurators/ifcfg.py b/vdsm/network/configurators/ifcfg.py index e008994..48c8b18 100644 --- a/vdsm/network/configurators/ifcfg.py +++ b/vdsm/network/configurators/ifcfg.py @@ -17,6 +17,7 @@ # Refer to the README and COPYING files for full details of the license # from __future__ import absolute_import +from __future__ import absolute_import import copy import glob diff --git a/vdsm/network/configurators/iproute2.py b/vdsm/network/configurators/iproute2.py index 70958fb..9a8b751 100644 --- a/vdsm/network/configurators/iproute2.py +++ b/vdsm/network/configurators/iproute2.py @@ -17,6 +17,7 @@ # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import import logging from vdsm import netinfo diff --git a/vdsm/network/configurators/libvirt.py b/vdsm/network/configurators/libvirt.py index 3cca006..ec62337 100644 --- a/vdsm/network/configurators/libvirt.py +++ b/vdsm/network/configurators/libvirt.py @@ -17,6 +17,7 @@ # Refer to the README and COPYING files for full details of the license # from __future__ import absolute_import +from __future__ import absolute_import from xml.dom.minidom import Document from xml.sax.saxutils import escape diff --git a/vdsm/network/configurators/pyroute_two.py b/vdsm/network/configurators/pyroute_two.py index 211c91b..c7730d3 100644 --- a/vdsm/network/configurators/pyroute_two.py +++ b/vdsm/network/configurators/pyroute_two.py @@ -17,6 +17,7 @@ # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import import logging from vdsm import netinfo diff --git a/vdsm/network/configurators/qos.py b/vdsm/network/configurators/qos.py index 06b07e7..25d049f 100644 --- a/vdsm/network/configurators/qos.py +++ b/vdsm/network/configurators/qos.py @@ -16,6 +16,7 @@ # # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import import errno import os from distutils.version import StrictVersion diff --git a/vdsm/network/errors.py b/vdsm/network/errors.py index cde0adb..0992a02 100644 --- a/vdsm/network/errors.py +++ b/vdsm/network/errors.py @@ -18,6 +18,7 @@ # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import ERR_OK = 0 ERR_BAD_PARAMS = 21 ERR_BAD_ADDR = 22 diff --git a/vdsm/network/models.py b/vdsm/network/models.py index c360ed6..df62487 100644 --- a/vdsm/network/models.py +++ b/vdsm/network/models.py @@ -16,6 +16,7 @@ # # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import import logging import re import socket diff --git a/vdsm/network/sourceroute.py b/vdsm/network/sourceroute.py index 5f06de0..66adeba 100644 --- a/vdsm/network/sourceroute.py +++ b/vdsm/network/sourceroute.py @@ -16,6 +16,7 @@ # # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import import os from glob import iglob diff --git a/vdsm/network/sourceroutethread.py b/vdsm/network/sourceroutethread.py index 928384e..0a49760 100644 --- a/vdsm/network/sourceroutethread.py +++ b/vdsm/network/sourceroutethread.py @@ -16,6 +16,7 @@ # # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import import logging import os import threading diff --git a/vdsm/network/tc/__init__.py b/vdsm/network/tc/__init__.py index 550d1b3..9ec330b 100644 --- a/vdsm/network/tc/__init__.py +++ b/vdsm/network/tc/__init__.py @@ -18,6 +18,7 @@ # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import from collections import namedtuple from functools import partial import errno diff --git a/vdsm/network/tc/_parser.py b/vdsm/network/tc/_parser.py index c71b2bc..6600a63 100644 --- a/vdsm/network/tc/_parser.py +++ b/vdsm/network/tc/_parser.py @@ -17,6 +17,7 @@ # # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import LINE_DELIMITER = 0 diff --git a/vdsm/network/tc/_wrapper.py b/vdsm/network/tc/_wrapper.py index 313e518..886b774 100644 --- a/vdsm/network/tc/_wrapper.py +++ b/vdsm/network/tc/_wrapper.py @@ -16,6 +16,7 @@ # # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import import errno import os diff --git a/vdsm/network/tc/cls.py b/vdsm/network/tc/cls.py index 0718786..9ad1c49 100644 --- a/vdsm/network/tc/cls.py +++ b/vdsm/network/tc/cls.py @@ -16,6 +16,7 @@ # # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import from copy import deepcopy from . import _parser diff --git a/vdsm/network/tc/filter.py b/vdsm/network/tc/filter.py index d456230..9b3913c 100644 --- a/vdsm/network/tc/filter.py +++ b/vdsm/network/tc/filter.py @@ -16,6 +16,7 @@ # # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import from . import _parser from . import _wrapper diff --git a/vdsm/network/tc/qdisc.py b/vdsm/network/tc/qdisc.py index 9cd991d..60acafa 100644 --- a/vdsm/network/tc/qdisc.py +++ b/vdsm/network/tc/qdisc.py @@ -16,6 +16,7 @@ # # Refer to the README and COPYING files for full details of the license # +from __future__ import absolute_import from fractions import Fraction from functools import partial -- To view, visit https://gerrit.ovirt.org/42045 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ibb3aed51c37b846c928fc2d443c9f848dcba5d7c Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Dan Kenigsberg <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
