utils/check-package: use explicit relative imports
PATCH 1/1 utils/check-package: use explicit relative imports
The syntax for explicit relative imports was introduced in Python2.6, and the implicit relative imports were removed in Python3.
According to PEP394, Python source files that use the python shebang line should be compatible with both Python2 and Python3. With this patch, users of distros where Python3 is the default are able to use check-package
--- utils/checkpackagelib/lib.py | 2 +- utils/checkpackagelib/lib_config.py | 10 +++++----- utils/checkpackagelib/lib_hash.py | 10 +++++----- utils/checkpackagelib/lib_mk.py | 10 +++++----- utils/checkpackagelib/lib_patch.py | 4 ++-- 5 files changed, 18 insertions(+), 18 deletions(-)
utils/checkpackagelib/lib.py +1 -1
@@ -1,6 +1,6 @@ # See utils/checkpackagelib/readme.txt before editing this file. -from base import _CheckFunction +from .base import _CheckFunction class ConsecutiveEmptyLines(_CheckFunction):
utils/checkpackagelib/lib_config.py +5 -5
@@ -5,11 +5,11 @@ import re -from base import _CheckFunction -from lib import ConsecutiveEmptyLines # noqa: F401 -from lib import EmptyLastLine # noqa: F401 -from lib import NewlineAtEof # noqa: F401 -from lib import TrailingSpace # noqa: F401 +from .base import _CheckFunction +from .lib import ConsecutiveEmptyLines # noqa: F401 +from .lib import EmptyLastLine # noqa: F401 +from .lib import NewlineAtEof # noqa: F401 +from .lib import TrailingSpace # noqa: F401 def _empty_or_comment(text):
utils/checkpackagelib/lib_hash.py +5 -5
@@ -5,11 +5,11 @@ import re -from base import _CheckFunction -from lib import ConsecutiveEmptyLines # noqa: F401 -from lib import EmptyLastLine # noqa: F401 -from lib import NewlineAtEof # noqa: F401 -from lib import TrailingSpace # noqa: F401 +from .base import _CheckFunction +from .lib import ConsecutiveEmptyLines # noqa: F401 +from .lib import EmptyLastLine # noqa: F401 +from .lib import NewlineAtEof # noqa: F401 +from .lib import TrailingSpace # noqa: F401 def _empty_line_or_comment(text):
utils/checkpackagelib/lib_mk.py +5 -5
@@ -6,11 +6,11 @@ import re -from base import _CheckFunction -from lib import ConsecutiveEmptyLines # noqa: F401 -from lib import EmptyLastLine # noqa: F401 -from lib import NewlineAtEof # noqa: F401 -from lib import TrailingSpace # noqa: F401 +from .base import _CheckFunction +from .lib import ConsecutiveEmptyLines # noqa: F401 +from .lib import EmptyLastLine # noqa: F401 +from .lib import NewlineAtEof # noqa: F401 +from .lib import TrailingSpace # noqa: F401 class Indent(_CheckFunction):
utils/checkpackagelib/lib_patch.py +2 -2
@@ -5,8 +5,8 @@ import re -from base import _CheckFunction -from lib import NewlineAtEof # noqa: F401 +from .base import _CheckFunction +from .lib import NewlineAtEof # noqa: F401 class ApplyOrder(_CheckFunction):
Signature · 1 line
2.19.2
PATCH 1/1 utils/check-package: use explicit relative imports
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Titouan" == Titouan Christophe <[email protected]> writes:
The syntax for explicit relative imports was introduced in Python2.6, and the implicit relative imports were removed in Python3.
Quoted 6 lines
According to PEP394, Python source files that use the
pythonshebang line should be compatible with both Python2 and Python3. With this patch, users of distros where Python3 is the default are able to use check-packageSigned-off-by Titouan Christophe <[email protected]>
Thanks, but I have instead applied Ricardo's patch:
https://patchwork.ozlabs.org/patch/956517/
Signature · 1 line
Bye, Peter Korsgaard