commit:     4f25fa69e4a57785163345b1f4cace62daad5fea
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
AuthorDate: Tue Dec  1 00:27:04 2015 +0000
Commit:     Arfrever Frehtes Taifersar Arahesis <arfrever <AT> apache <DOT> org>
CommitDate: Tue Dec  1 00:27:04 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=4f25fa69

ebuild: Move imports to the top.

 bin/ebuild | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/bin/ebuild b/bin/ebuild
index ed1231f..1f99177 100755
--- a/bin/ebuild
+++ b/bin/ebuild
@@ -8,6 +8,8 @@ import argparse
 import platform
 import signal
 import sys
+import textwrap
+
 # This block ensures that ^C interrupts are handled quietly.
 try:
 
@@ -49,7 +51,9 @@ from portage import _shell_quote
 from portage import _unicode_decode
 from portage import _unicode_encode
 from portage.const import VDB_PATH
-from portage.exception import PortageKeyError
+from portage.exception import PermissionDenied, PortageKeyError, \
+       PortagePackageException, UnsupportedAPIException
+import portage.util
 from _emerge.Package import Package
 from _emerge.RootConfig import RootConfig
 
@@ -96,8 +100,6 @@ if not opts.ignore_default_opts:
 debug = opts.debug
 force = opts.force
 
-import portage.util, portage.const
-
 # do this _after_ 'import portage' to prevent unnecessary tracing
 if debug and "python-trace" in portage.features:
        import portage.debug
@@ -305,8 +307,7 @@ def stale_env_warning():
                        msg = ("Existing ${T}/environment for '%s' will be 
sourced. " + \
                                "Run 'clean' to start with a fresh 
environment.") % \
                                (tmpsettings["PF"], )
-                       from textwrap import wrap
-                       msg = wrap(msg, 70)
+                       msg = textwrap.wrap(msg, 70)
                        for x in msg:
                                portage.writemsg(">>> %s\n" % x)
 
@@ -314,9 +315,6 @@ def stale_env_warning():
                                
open(os.path.join(tmpsettings['PORTAGE_BUILDDIR'],
                                        '.ebuild_changed'), 'w').close()
 
-from portage.exception import PermissionDenied, \
-       PortagePackageException, UnsupportedAPIException
-
 if 'digest' in tmpsettings.features:
        if pargs and pargs[0] not in ("digest", "manifest"):
                pargs = ['digest'] + pargs
@@ -345,8 +343,7 @@ for arg in pargs:
                # aux_get error
                a = 1
        except UnsupportedAPIException as e:
-               from textwrap import wrap
-               msg = wrap(str(e), 70)
+               msg = textwrap.wrap(str(e), 70)
                del e
                for x in msg:
                        portage.writemsg("!!! %s\n" % x, noiselevel=-1)

Reply via email to