diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-05-17 11:40:01 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-05-17 12:42:08 +0300 |
commit | 4d3a53ff36526669fcde7b64dc947e8d76aba56b (patch) | |
tree | 659ef2923ef2123a008394fefc066cc69585aaa0 /bitbake/lib/bb/utils.py | |
parent | 0a52bdfb9a63a0cc5654406f98b5bbcd2de3aad8 (diff) | |
download | poky-4d3a53ff36526669fcde7b64dc947e8d76aba56b.tar.gz |
bitbake: fetch2/utils: Clean up imports
Move various random imports to the start of the modules as cleanup
and avoid an import issue with bb.process on python 2.6.
(Bitbake rev: aed4adfbe3a591ca4f8e41fb763c9f961bf2e6d5)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/utils.py')
-rw-r--r-- | bitbake/lib/bb/utils.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index 2e10fc24dd..1ecc44a01a 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py | |||
@@ -27,6 +27,10 @@ import bb | |||
27 | import bb.msg | 27 | import bb.msg |
28 | import multiprocessing | 28 | import multiprocessing |
29 | import fcntl | 29 | import fcntl |
30 | import subprocess | ||
31 | import glob | ||
32 | import traceback | ||
33 | import errno | ||
30 | from commands import getstatusoutput | 34 | from commands import getstatusoutput |
31 | from contextlib import contextmanager | 35 | from contextlib import contextmanager |
32 | 36 | ||
@@ -276,7 +280,6 @@ def better_compile(text, file, realfile, mode = "exec"): | |||
276 | def _print_exception(t, value, tb, realfile, text, context): | 280 | def _print_exception(t, value, tb, realfile, text, context): |
277 | error = [] | 281 | error = [] |
278 | try: | 282 | try: |
279 | import traceback | ||
280 | exception = traceback.format_exception_only(t, value) | 283 | exception = traceback.format_exception_only(t, value) |
281 | error.append('Error executing a python function in %s:\n' % realfile) | 284 | error.append('Error executing a python function in %s:\n' % realfile) |
282 | 285 | ||
@@ -565,11 +568,9 @@ def remove(path, recurse=False): | |||
565 | if not path: | 568 | if not path: |
566 | return | 569 | return |
567 | if recurse: | 570 | if recurse: |
568 | import subprocess, glob | ||
569 | # shutil.rmtree(name) would be ideal but its too slow | 571 | # shutil.rmtree(name) would be ideal but its too slow |
570 | subprocess.call(['rm', '-rf'] + glob.glob(path)) | 572 | subprocess.call(['rm', '-rf'] + glob.glob(path)) |
571 | return | 573 | return |
572 | import os, errno, glob | ||
573 | for name in glob.glob(path): | 574 | for name in glob.glob(path): |
574 | try: | 575 | try: |
575 | os.unlink(name) | 576 | os.unlink(name) |