diff options
Diffstat (limited to 'meta/classes/patch.bbclass')
-rw-r--r-- | meta/classes/patch.bbclass | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/meta/classes/patch.bbclass b/meta/classes/patch.bbclass index ba0f19215d..0706a02bc9 100644 --- a/meta/classes/patch.bbclass +++ b/meta/classes/patch.bbclass | |||
@@ -4,8 +4,6 @@ | |||
4 | QUILTRCFILE ?= "${STAGING_BINDIR_NATIVE}/quiltrc" | 4 | QUILTRCFILE ?= "${STAGING_BINDIR_NATIVE}/quiltrc" |
5 | 5 | ||
6 | def patch_init(d): | 6 | def patch_init(d): |
7 | import os, sys | ||
8 | |||
9 | class NotFoundError(Exception): | 7 | class NotFoundError(Exception): |
10 | def __init__(self, path): | 8 | def __init__(self, path): |
11 | self.path = path | 9 | self.path = path |
@@ -13,8 +11,6 @@ def patch_init(d): | |||
13 | return "Error: %s not found." % self.path | 11 | return "Error: %s not found." % self.path |
14 | 12 | ||
15 | def md5sum(fname): | 13 | def md5sum(fname): |
16 | import sys | ||
17 | |||
18 | # when we move to Python 2.5 as minimal supported | 14 | # when we move to Python 2.5 as minimal supported |
19 | # we can kill that try/except as hashlib is 2.5+ | 15 | # we can kill that try/except as hashlib is 2.5+ |
20 | try: | 16 | try: |
@@ -76,8 +72,6 @@ def patch_init(d): | |||
76 | def __str__(self): | 72 | def __str__(self): |
77 | return "Patch Error: %s" % self.msg | 73 | return "Patch Error: %s" % self.msg |
78 | 74 | ||
79 | import bb, bb.data, bb.fetch | ||
80 | |||
81 | class PatchSet(object): | 75 | class PatchSet(object): |
82 | defaults = { | 76 | defaults = { |
83 | "strippath": 1 | 77 | "strippath": 1 |
@@ -251,6 +245,7 @@ def patch_init(d): | |||
251 | try: | 245 | try: |
252 | output = runcmd(["quilt", "applied"], self.dir) | 246 | output = runcmd(["quilt", "applied"], self.dir) |
253 | except CmdError: | 247 | except CmdError: |
248 | import sys | ||
254 | if sys.exc_value.output.strip() == "No patches applied": | 249 | if sys.exc_value.output.strip() == "No patches applied": |
255 | return | 250 | return |
256 | else: | 251 | else: |
@@ -364,6 +359,7 @@ def patch_init(d): | |||
364 | try: | 359 | try: |
365 | self.patchset.Push() | 360 | self.patchset.Push() |
366 | except Exception: | 361 | except Exception: |
362 | import sys | ||
367 | os.chdir(olddir) | 363 | os.chdir(olddir) |
368 | raise sys.exc_value | 364 | raise sys.exc_value |
369 | 365 | ||
@@ -458,9 +454,6 @@ PATCHDEPENDENCY = "${PATCHTOOL}-native:do_populate_staging" | |||
458 | do_patch[depends] = "${PATCHDEPENDENCY}" | 454 | do_patch[depends] = "${PATCHDEPENDENCY}" |
459 | 455 | ||
460 | python patch_do_patch() { | 456 | python patch_do_patch() { |
461 | import re | ||
462 | import bb.fetch | ||
463 | |||
464 | patch_init(d) | 457 | patch_init(d) |
465 | 458 | ||
466 | src_uri = (bb.data.getVar('SRC_URI', d, 1) or '').split() | 459 | src_uri = (bb.data.getVar('SRC_URI', d, 1) or '').split() |