diff options
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/bb/fetch2/__init__.py | 11 | ||||
-rw-r--r-- | bitbake/lib/bb/utils.py | 7 |
2 files changed, 8 insertions, 10 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py index dd1cc932d4..9029a5a83c 100644 --- a/bitbake/lib/bb/fetch2/__init__.py +++ b/bitbake/lib/bb/fetch2/__init__.py | |||
@@ -28,6 +28,8 @@ BitBake build tools. | |||
28 | from __future__ import absolute_import | 28 | from __future__ import absolute_import |
29 | from __future__ import print_function | 29 | from __future__ import print_function |
30 | import os, re | 30 | import os, re |
31 | import signal | ||
32 | import glob | ||
31 | import logging | 33 | import logging |
32 | import urllib | 34 | import urllib |
33 | import urlparse | 35 | import urlparse |
@@ -38,6 +40,8 @@ import operator | |||
38 | import bb.persist_data, bb.utils | 40 | import bb.persist_data, bb.utils |
39 | import bb.checksum | 41 | import bb.checksum |
40 | from bb import data | 42 | from bb import data |
43 | import bb.process | ||
44 | import subprocess | ||
41 | 45 | ||
42 | __version__ = "2" | 46 | __version__ = "2" |
43 | _checksum_cache = bb.checksum.FileChecksumCache() | 47 | _checksum_cache = bb.checksum.FileChecksumCache() |
@@ -584,7 +588,6 @@ def update_stamp(u, ud, d): | |||
584 | open(ud.donestamp, 'w').close() | 588 | open(ud.donestamp, 'w').close() |
585 | 589 | ||
586 | def subprocess_setup(): | 590 | def subprocess_setup(): |
587 | import signal | ||
588 | # Python installs a SIGPIPE handler by default. This is usually not what | 591 | # Python installs a SIGPIPE handler by default. This is usually not what |
589 | # non-Python subprocesses expect. | 592 | # non-Python subprocesses expect. |
590 | # SIGPIPE errors are known issues with gzip/bash | 593 | # SIGPIPE errors are known issues with gzip/bash |
@@ -653,9 +656,6 @@ def runfetchcmd(cmd, d, quiet = False, cleanup = []): | |||
653 | Optionally remove the files/directories listed in cleanup upon failure | 656 | Optionally remove the files/directories listed in cleanup upon failure |
654 | """ | 657 | """ |
655 | 658 | ||
656 | import bb.process | ||
657 | import subprocess | ||
658 | |||
659 | # Need to export PATH as binary could be in metadata paths | 659 | # Need to export PATH as binary could be in metadata paths |
660 | # rather than host provided | 660 | # rather than host provided |
661 | # Also include some other variables. | 661 | # Also include some other variables. |
@@ -913,7 +913,6 @@ def get_file_checksums(filelist, pn): | |||
913 | try: | 913 | try: |
914 | checksum = _checksum_cache.get_checksum(f) | 914 | checksum = _checksum_cache.get_checksum(f) |
915 | except OSError as e: | 915 | except OSError as e: |
916 | import traceback | ||
917 | bb.warn("Unable to get checksum for %s SRC_URI entry %s: %s" % (pn, os.path.basename(f), e)) | 916 | bb.warn("Unable to get checksum for %s SRC_URI entry %s: %s" % (pn, os.path.basename(f), e)) |
918 | return None | 917 | return None |
919 | return checksum | 918 | return checksum |
@@ -923,7 +922,6 @@ def get_file_checksums(filelist, pn): | |||
923 | checksum = None | 922 | checksum = None |
924 | if '*' in pth: | 923 | if '*' in pth: |
925 | # Handle globs | 924 | # Handle globs |
926 | import glob | ||
927 | for f in glob.glob(pth): | 925 | for f in glob.glob(pth): |
928 | checksum = checksum_file(f) | 926 | checksum = checksum_file(f) |
929 | if checksum: | 927 | if checksum: |
@@ -1133,7 +1131,6 @@ class FetchMethod(object): | |||
1133 | raise NoMethodError(url) | 1131 | raise NoMethodError(url) |
1134 | 1132 | ||
1135 | def unpack(self, urldata, rootdir, data): | 1133 | def unpack(self, urldata, rootdir, data): |
1136 | import subprocess | ||
1137 | iterate = False | 1134 | iterate = False |
1138 | file = urldata.localpath | 1135 | file = urldata.localpath |
1139 | 1136 | ||
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) |