mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-19 20:59:01 +02:00
update: allow patch parsing to work with python 2
If we want to be able to read in patch information on python2-based branches (e.g. fido) then we need to use codecs.open() instead of open() here since python2's open() did not support the encoding parameter. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
parent
11a1d0859d
commit
8bb62fb82d
|
@ -17,6 +17,7 @@ import re
|
||||||
import tempfile
|
import tempfile
|
||||||
import shutil
|
import shutil
|
||||||
import errno
|
import errno
|
||||||
|
import codecs
|
||||||
from distutils.version import LooseVersion
|
from distutils.version import LooseVersion
|
||||||
import itertools
|
import itertools
|
||||||
import utils
|
import utils
|
||||||
|
@ -77,7 +78,7 @@ def collect_patch(recipe, patchfn, layerdir_start, stop_on_error):
|
||||||
try:
|
try:
|
||||||
for encoding in ['utf-8', 'latin-1']:
|
for encoding in ['utf-8', 'latin-1']:
|
||||||
try:
|
try:
|
||||||
with open(patchfn, 'r', encoding=encoding) as f:
|
with codecs.open(patchfn, 'r', encoding=encoding) as f:
|
||||||
for line in f:
|
for line in f:
|
||||||
line = line.rstrip()
|
line = line.rstrip()
|
||||||
if line.startswith('Index: ') or line.startswith('diff -') or line.startswith('+++ '):
|
if line.startswith('Index: ') or line.startswith('diff -') or line.startswith('+++ '):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user