diff options
Diffstat (limited to 'meta/lib/oe/recipeutils.py')
-rw-r--r-- | meta/lib/oe/recipeutils.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/meta/lib/oe/recipeutils.py b/meta/lib/oe/recipeutils.py index 6c7adb5bdb..c183f71d3c 100644 --- a/meta/lib/oe/recipeutils.py +++ b/meta/lib/oe/recipeutils.py | |||
@@ -11,7 +11,7 @@ import os.path | |||
11 | import tempfile | 11 | import tempfile |
12 | import textwrap | 12 | import textwrap |
13 | import difflib | 13 | import difflib |
14 | import utils | 14 | from . import utils |
15 | import shutil | 15 | import shutil |
16 | import re | 16 | import re |
17 | import fnmatch | 17 | import fnmatch |
@@ -318,7 +318,7 @@ def patch_recipe(d, fn, varvalues, patch=False, relpath=''): | |||
318 | varfiles = get_var_files(fn, varlist, d) | 318 | varfiles = get_var_files(fn, varlist, d) |
319 | locs = localise_file_vars(fn, varfiles, varlist) | 319 | locs = localise_file_vars(fn, varfiles, varlist) |
320 | patches = [] | 320 | patches = [] |
321 | for f,v in locs.iteritems(): | 321 | for f,v in locs.items(): |
322 | vals = {k: varvalues[k] for k in v} | 322 | vals = {k: varvalues[k] for k in v} |
323 | patchdata = patch_recipe_file(f, vals, patch, relpath) | 323 | patchdata = patch_recipe_file(f, vals, patch, relpath) |
324 | if patch: | 324 | if patch: |
@@ -536,7 +536,7 @@ def bbappend_recipe(rd, destlayerdir, srcfiles, install=None, wildcardver=False, | |||
536 | bbappendlines = [] | 536 | bbappendlines = [] |
537 | if extralines: | 537 | if extralines: |
538 | if isinstance(extralines, dict): | 538 | if isinstance(extralines, dict): |
539 | for name, value in extralines.iteritems(): | 539 | for name, value in extralines.items(): |
540 | bbappendlines.append((name, '=', value)) | 540 | bbappendlines.append((name, '=', value)) |
541 | else: | 541 | else: |
542 | # Do our best to split it | 542 | # Do our best to split it |
@@ -550,14 +550,14 @@ def bbappend_recipe(rd, destlayerdir, srcfiles, install=None, wildcardver=False, | |||
550 | raise Exception('Invalid extralines value passed') | 550 | raise Exception('Invalid extralines value passed') |
551 | 551 | ||
552 | def popline(varname): | 552 | def popline(varname): |
553 | for i in xrange(0, len(bbappendlines)): | 553 | for i in range(0, len(bbappendlines)): |
554 | if bbappendlines[i][0] == varname: | 554 | if bbappendlines[i][0] == varname: |
555 | line = bbappendlines.pop(i) | 555 | line = bbappendlines.pop(i) |
556 | return line | 556 | return line |
557 | return None | 557 | return None |
558 | 558 | ||
559 | def appendline(varname, op, value): | 559 | def appendline(varname, op, value): |
560 | for i in xrange(0, len(bbappendlines)): | 560 | for i in range(0, len(bbappendlines)): |
561 | item = bbappendlines[i] | 561 | item = bbappendlines[i] |
562 | if item[0] == varname: | 562 | if item[0] == varname: |
563 | bbappendlines[i] = (item[0], item[1], item[2] + ' ' + value) | 563 | bbappendlines[i] = (item[0], item[1], item[2] + ' ' + value) |
@@ -576,7 +576,7 @@ def bbappend_recipe(rd, destlayerdir, srcfiles, install=None, wildcardver=False, | |||
576 | copyfiles = {} | 576 | copyfiles = {} |
577 | if srcfiles: | 577 | if srcfiles: |
578 | instfunclines = [] | 578 | instfunclines = [] |
579 | for newfile, origsrcfile in srcfiles.iteritems(): | 579 | for newfile, origsrcfile in srcfiles.items(): |
580 | srcfile = origsrcfile | 580 | srcfile = origsrcfile |
581 | srcurientry = None | 581 | srcurientry = None |
582 | if not srcfile: | 582 | if not srcfile: |
@@ -644,7 +644,7 @@ def bbappend_recipe(rd, destlayerdir, srcfiles, install=None, wildcardver=False, | |||
644 | 644 | ||
645 | if removevar in removevalues: | 645 | if removevar in removevalues: |
646 | remove = removevalues[removevar] | 646 | remove = removevalues[removevar] |
647 | if isinstance(remove, basestring): | 647 | if isinstance(remove, str): |
648 | if remove in splitval: | 648 | if remove in splitval: |
649 | splitval.remove(remove) | 649 | splitval.remove(remove) |
650 | changed = True | 650 | changed = True |
@@ -674,7 +674,7 @@ def bbappend_recipe(rd, destlayerdir, srcfiles, install=None, wildcardver=False, | |||
674 | 674 | ||
675 | varnames = [item[0] for item in bbappendlines] | 675 | varnames = [item[0] for item in bbappendlines] |
676 | if removevalues: | 676 | if removevalues: |
677 | varnames.extend(removevalues.keys()) | 677 | varnames.extend(list(removevalues.keys())) |
678 | 678 | ||
679 | with open(appendpath, 'r') as f: | 679 | with open(appendpath, 'r') as f: |
680 | (updated, newlines) = bb.utils.edit_metadata(f, varnames, appendfile_varfunc) | 680 | (updated, newlines) = bb.utils.edit_metadata(f, varnames, appendfile_varfunc) |
@@ -699,7 +699,7 @@ def bbappend_recipe(rd, destlayerdir, srcfiles, install=None, wildcardver=False, | |||
699 | if copyfiles: | 699 | if copyfiles: |
700 | if machine: | 700 | if machine: |
701 | destsubdir = os.path.join(destsubdir, machine) | 701 | destsubdir = os.path.join(destsubdir, machine) |
702 | for newfile, srcfile in copyfiles.iteritems(): | 702 | for newfile, srcfile in copyfiles.items(): |
703 | filedest = os.path.join(appenddir, destsubdir, os.path.basename(srcfile)) | 703 | filedest = os.path.join(appenddir, destsubdir, os.path.basename(srcfile)) |
704 | if os.path.abspath(newfile) != os.path.abspath(filedest): | 704 | if os.path.abspath(newfile) != os.path.abspath(filedest): |
705 | bb.note('Copying %s to %s' % (newfile, filedest)) | 705 | bb.note('Copying %s to %s' % (newfile, filedest)) |
@@ -725,12 +725,12 @@ def replace_dir_vars(path, d): | |||
725 | """Replace common directory paths with appropriate variable references (e.g. /etc becomes ${sysconfdir})""" | 725 | """Replace common directory paths with appropriate variable references (e.g. /etc becomes ${sysconfdir})""" |
726 | dirvars = {} | 726 | dirvars = {} |
727 | # Sort by length so we get the variables we're interested in first | 727 | # Sort by length so we get the variables we're interested in first |
728 | for var in sorted(d.keys(), key=len): | 728 | for var in sorted(list(d.keys()), key=len): |
729 | if var.endswith('dir') and var.lower() == var: | 729 | if var.endswith('dir') and var.lower() == var: |
730 | value = d.getVar(var, True) | 730 | value = d.getVar(var, True) |
731 | if value.startswith('/') and not '\n' in value and value not in dirvars: | 731 | if value.startswith('/') and not '\n' in value and value not in dirvars: |
732 | dirvars[value] = var | 732 | dirvars[value] = var |
733 | for dirpath in sorted(dirvars.keys(), reverse=True): | 733 | for dirpath in sorted(list(dirvars.keys()), reverse=True): |
734 | path = path.replace(dirpath, '${%s}' % dirvars[dirpath]) | 734 | path = path.replace(dirpath, '${%s}' % dirvars[dirpath]) |
735 | return path | 735 | return path |
736 | 736 | ||