diff options
author | Chris Larson <chris_larson@mentor.com> | 2010-04-08 10:22:29 -0700 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-07-02 15:41:32 +0100 |
commit | 1c74fd768f8e4f5778411538b906cdcc22fe3f67 (patch) | |
tree | 3d3a5f1021276055f91322afa64a9eee53d3cc9f /bitbake/lib/bb/utils.py | |
parent | 7acc132cac873e60005516272473a55a8160b9c4 (diff) | |
download | poky-1c74fd768f8e4f5778411538b906cdcc22fe3f67.tar.gz |
Import fixups
(Bitbake rev: 4fa052f426e3205ebace713eaa22deddc0420e8a)
Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb/utils.py')
-rw-r--r-- | bitbake/lib/bb/utils.py | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index 93c158c604..132d5e56b2 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py | |||
@@ -19,7 +19,11 @@ BitBake Utility Functions | |||
19 | # with this program; if not, write to the Free Software Foundation, Inc., | 19 | # with this program; if not, write to the Free Software Foundation, Inc., |
20 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | 20 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
21 | 21 | ||
22 | import re, fcntl, os, types, bb, string, stat, shutil, time | 22 | import re, fcntl, os, types, string, stat, shutil, time |
23 | import sys | ||
24 | import bb | ||
25 | import errno | ||
26 | import bb.msg | ||
23 | from commands import getstatusoutput | 27 | from commands import getstatusoutput |
24 | 28 | ||
25 | # Version comparison | 29 | # Version comparison |
@@ -287,8 +291,6 @@ def _print_trace(body, line): | |||
287 | """ | 291 | """ |
288 | Print the Environment of a Text Body | 292 | Print the Environment of a Text Body |
289 | """ | 293 | """ |
290 | import bb | ||
291 | |||
292 | # print the environment of the method | 294 | # print the environment of the method |
293 | bb.msg.error(bb.msg.domain.Util, "Printing the environment of the function") | 295 | bb.msg.error(bb.msg.domain.Util, "Printing the environment of the function") |
294 | min_line = max(1, line-4) | 296 | min_line = max(1, line-4) |
@@ -305,8 +307,6 @@ def better_compile(text, file, realfile, mode = "exec"): | |||
305 | try: | 307 | try: |
306 | return compile(text, file, mode) | 308 | return compile(text, file, mode) |
307 | except Exception, e: | 309 | except Exception, e: |
308 | import bb, sys | ||
309 | |||
310 | # split the text into lines again | 310 | # split the text into lines again |
311 | body = text.split('\n') | 311 | body = text.split('\n') |
312 | bb.msg.error(bb.msg.domain.Util, "Error in compiling python function in: ", realfile) | 312 | bb.msg.error(bb.msg.domain.Util, "Error in compiling python function in: ", realfile) |
@@ -324,7 +324,7 @@ def better_exec(code, context, text, realfile): | |||
324 | print the lines that are responsible for the | 324 | print the lines that are responsible for the |
325 | error. | 325 | error. |
326 | """ | 326 | """ |
327 | import bb, sys | 327 | import bb.parse |
328 | try: | 328 | try: |
329 | exec code in _context, context | 329 | exec code in _context, context |
330 | except: | 330 | except: |
@@ -361,7 +361,6 @@ def lockfile(name): | |||
361 | """ | 361 | """ |
362 | path = os.path.dirname(name) | 362 | path = os.path.dirname(name) |
363 | if not os.path.isdir(path): | 363 | if not os.path.isdir(path): |
364 | import bb, sys | ||
365 | bb.msg.error(bb.msg.domain.Util, "Error, lockfile path does not exist!: %s" % path) | 364 | bb.msg.error(bb.msg.domain.Util, "Error, lockfile path does not exist!: %s" % path) |
366 | sys.exit(1) | 365 | sys.exit(1) |
367 | 366 | ||
@@ -467,8 +466,6 @@ def filter_environment(good_vars): | |||
467 | are not known and may influence the build in a negative way. | 466 | are not known and may influence the build in a negative way. |
468 | """ | 467 | """ |
469 | 468 | ||
470 | import bb | ||
471 | |||
472 | removed_vars = [] | 469 | removed_vars = [] |
473 | for key in os.environ.keys(): | 470 | for key in os.environ.keys(): |
474 | if key in good_vars: | 471 | if key in good_vars: |
@@ -509,7 +506,7 @@ def build_environment(d): | |||
509 | """ | 506 | """ |
510 | Build an environment from all exported variables. | 507 | Build an environment from all exported variables. |
511 | """ | 508 | """ |
512 | import bb | 509 | import bb.data |
513 | for var in bb.data.keys(d): | 510 | for var in bb.data.keys(d): |
514 | export = bb.data.getVarFlag(var, "export", d) | 511 | export = bb.data.getVarFlag(var, "export", d) |
515 | if export: | 512 | if export: |
@@ -550,9 +547,8 @@ def mkdirhier(dir): | |||
550 | os.makedirs(dir) | 547 | os.makedirs(dir) |
551 | bb.msg.debug(2, bb.msg.domain.Util, "created " + dir) | 548 | bb.msg.debug(2, bb.msg.domain.Util, "created " + dir) |
552 | except OSError, e: | 549 | except OSError, e: |
553 | if e.errno != 17: raise e | 550 | if e.errno != errno.EEXIST: |
554 | 551 | raise e | |
555 | import stat | ||
556 | 552 | ||
557 | def movefile(src, dest, newmtime = None, sstat = None): | 553 | def movefile(src, dest, newmtime = None, sstat = None): |
558 | """Moves a file from src to dest, preserving all permissions and | 554 | """Moves a file from src to dest, preserving all permissions and |
@@ -603,7 +599,6 @@ def movefile(src, dest, newmtime = None, sstat = None): | |||
603 | ret = os.rename(src, dest) | 599 | ret = os.rename(src, dest) |
604 | renamefailed = 0 | 600 | renamefailed = 0 |
605 | except Exception, e: | 601 | except Exception, e: |
606 | import errno | ||
607 | if e[0] != errno.EXDEV: | 602 | if e[0] != errno.EXDEV: |
608 | # Some random error. | 603 | # Some random error. |
609 | print "movefile: Failed to move", src, "to", dest, e | 604 | print "movefile: Failed to move", src, "to", dest, e |