diff options
author | Коренберг Марк (ноутбук дома) <socketpair@gmail.com> | 2012-06-04 16:54:16 (GMT) |
---|---|---|
committer | Коренберг Марк (ноутбук дома) <socketpair@gmail.com> | 2012-06-08 16:26:35 (GMT) |
commit | 4be1ae2ae22e100e6bbc4bd127af49296efbd763 (patch) | |
tree | 1f5238a7dc064f0bdd77afa2dfb10b4ff8885780 | |
parent | f55ea7ff9d318be938be3f3ae4f331ba5c7dc150 (diff) | |
download | libnl-4be1ae2ae22e100e6bbc4bd127af49296efbd763.zip libnl-4be1ae2ae22e100e6bbc4bd127af49296efbd763.tar.gz libnl-4be1ae2ae22e100e6bbc4bd127af49296efbd763.tar.bz2 |
Introduce Python's absolute_imports
Helps greatly when porting to Python 3
-rw-r--r-- | python/netlink/core.py | 5 | ||||
-rw-r--r-- | python/netlink/route/address.py | 13 | ||||
-rw-r--r-- | python/netlink/route/link.py | 12 | ||||
-rw-r--r-- | python/netlink/route/links/dummy.py | 5 | ||||
-rw-r--r-- | python/netlink/route/links/inet.py | 9 | ||||
-rw-r--r-- | python/netlink/route/links/vlan.py | 6 | ||||
-rw-r--r-- | python/netlink/route/qdisc/htb.py | 10 | ||||
-rw-r--r-- | python/netlink/route/tc.py | 12 | ||||
-rw-r--r-- | python/netlink/util.py | 6 |
9 files changed, 47 insertions, 31 deletions
diff --git a/python/netlink/core.py b/python/netlink/core.py index e311d5f..26ea6ca 100644 --- a/python/netlink/core.py +++ b/python/netlink/core.py @@ -25,8 +25,11 @@ The following exceptions are defined: All other classes or functions in this module are considered implementation details. """ +from __future__ import absolute_import -import capi + + +from . import capi import sys import socket import struct diff --git a/python/netlink/route/address.py b/python/netlink/route/address.py index 3654834..29b8072 100644 --- a/python/netlink/route/address.py +++ b/python/netlink/route/address.py @@ -5,17 +5,20 @@ """Module providing access to network addresses """ +from __future__ import absolute_import + + __version__ = "1.0" __all__ = [ 'AddressCache', 'Address'] import datetime -import netlink.core as netlink -import netlink.capi as core_capi -import netlink.route.capi as capi -import netlink.route.link as Link -import netlink.util as util +from .. import core as netlink +from .. import capi as core_capi +from . import capi as capi +from . import link as Link +from .. import util as util ########################################################################### # Address Cache diff --git a/python/netlink/route/link.py b/python/netlink/route/link.py index 3a428c9..fce2cd7 100644 --- a/python/netlink/route/link.py +++ b/python/netlink/route/link.py @@ -34,6 +34,8 @@ The following public functions exist: """ +from __future__ import absolute_import + __version__ = "0.1" __all__ = [ 'LinkCache', @@ -42,11 +44,11 @@ __all__ = [ import socket import sys -import netlink.core as netlink -import netlink.capi as core_capi -import netlink.route.capi as capi -import netlink.route.links.inet as inet -import netlink.util as util +from .. import core as netlink +from .. import capi as core_capi +from . import capi as capi +from .links import inet as inet +from .. import util as util ########################################################################### # Link statistics definitions diff --git a/python/netlink/route/links/dummy.py b/python/netlink/route/links/dummy.py index 8210413..6c96617 100644 --- a/python/netlink/route/links/dummy.py +++ b/python/netlink/route/links/dummy.py @@ -5,13 +5,14 @@ """Dummy """ +from __future__ import absolute_import __version__ = "1.0" __all__ = ['init'] -import netlink.core as netlink -import netlink.route.capi as capi +from ... import core as netlink +from .. import capi as capi class DummyLink(object): def __init__(self, link): self._rtnl_link = link diff --git a/python/netlink/route/links/inet.py b/python/netlink/route/links/inet.py index 63c234f..73bde6b 100644 --- a/python/netlink/route/links/inet.py +++ b/python/netlink/route/links/inet.py @@ -6,12 +6,13 @@ """ -__all__ = [''] +from __future__ import absolute_import -import netlink.core as netlink -import netlink.route.capi as capi -import netlink.util as util +__all__ = [''] +from ... import core as netlink +from .. import capi as capi +from ... import util as util DEVCONF_FORWARDING = 1 DEVCONF_MC_FORWARDING = 2 DEVCONF_PROXY_ARP = 3 diff --git a/python/netlink/route/links/vlan.py b/python/netlink/route/links/vlan.py index 7f28247..134e721 100644 --- a/python/netlink/route/links/vlan.py +++ b/python/netlink/route/links/vlan.py @@ -6,9 +6,11 @@ """ -import netlink.core as netlink -import netlink.route.capi as capi +from __future__ import absolute_import + +from ... import core as netlink +from .. import capi as capi class VLANLink(object): def __init__(self, link): self._link = link diff --git a/python/netlink/route/qdisc/htb.py b/python/netlink/route/qdisc/htb.py index 13e10f2..23c7f75 100644 --- a/python/netlink/route/qdisc/htb.py +++ b/python/netlink/route/qdisc/htb.py @@ -6,10 +6,12 @@ """ -import netlink.core as netlink -import netlink.util as util -import netlink.route.capi as capi -import netlink.route.tc as tc +from __future__ import absolute_import + +from ... import core as netlink +from ... import util as util +from .. import capi as capi +from .. import tc as tc class HTBQdisc(object): def __init__(self, qdisc): diff --git a/python/netlink/route/tc.py b/python/netlink/route/tc.py index bae9bca..0d20e79 100644 --- a/python/netlink/route/tc.py +++ b/python/netlink/route/tc.py @@ -1,6 +1,7 @@ # # Copyright (c) 2011 Thomas Graf <tgraf@suug.ch> # +from __future__ import absolute_import __all__ = [ 'TcCache', @@ -12,12 +13,11 @@ __all__ = [ import socket import sys -import netlink.core as netlink -import netlink.capi as core_capi -import netlink.route.capi as capi -import netlink.util as util - -import netlink.route.link as Link +from .. import core as netlink +from .. import capi as core_capi +from . import capi as capi +from .. import util as util +from . import link as Link TC_PACKETS = 0 TC_BYTES = 1 diff --git a/python/netlink/util.py b/python/netlink/util.py index 191c531..0a73db4 100644 --- a/python/netlink/util.py +++ b/python/netlink/util.py @@ -8,8 +8,10 @@ """ -import netlink.core as netlink -import netlink.capi as capi +from __future__ import absolute_import + +from . import core as netlink +from . import capi as capi from string import Formatter __version__ = "1.0" |