summaryrefslogtreecommitdiffstats
path: root/external/poky/bitbake/lib/bb/parse/parse_py/ConfHandler.py
diff options
context:
space:
mode:
authortakeshi_hoshina <takeshi_hoshina@mail.toyota.co.jp>2020-11-02 11:07:33 +0900
committertakeshi_hoshina <takeshi_hoshina@mail.toyota.co.jp>2020-11-02 11:07:33 +0900
commit1c7d6584a7811b7785ae5c1e378f14b5ba0971cf (patch)
treecd70a267a5ef105ba32f200aa088e281fbd85747 /external/poky/bitbake/lib/bb/parse/parse_py/ConfHandler.py
parent4204309872da5cb401cbb2729d9e2d4869a87f42 (diff)
recipes
Diffstat (limited to 'external/poky/bitbake/lib/bb/parse/parse_py/ConfHandler.py')
-rw-r--r--external/poky/bitbake/lib/bb/parse/parse_py/ConfHandler.py61
1 files changed, 24 insertions, 37 deletions
diff --git a/external/poky/bitbake/lib/bb/parse/parse_py/ConfHandler.py b/external/poky/bitbake/lib/bb/parse/parse_py/ConfHandler.py
index 9d3ebe16..af64d344 100644
--- a/external/poky/bitbake/lib/bb/parse/parse_py/ConfHandler.py
+++ b/external/poky/bitbake/lib/bb/parse/parse_py/ConfHandler.py
@@ -1,6 +1,3 @@
-#!/usr/bin/env python
-# ex:ts=4:sw=4:sts=4:et
-# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
"""
class for handling configuration data files
@@ -11,18 +8,8 @@
# Copyright (C) 2003, 2004 Chris Larson
# Copyright (C) 2003, 2004 Phil Blundell
#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 as
-# published by the Free Software Foundation.
+# SPDX-License-Identifier: GPL-2.0-only
#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
import errno
import re
@@ -132,30 +119,30 @@ def handle(fn, data, include):
oldfile = data.getVar('FILE', False)
abs_fn = resolve_file(fn, data)
- f = open(abs_fn, 'r')
-
- statements = ast.StatementGroup()
- lineno = 0
- while True:
- lineno = lineno + 1
- s = f.readline()
- if not s:
- break
- w = s.strip()
- # skip empty lines
- if not w:
- continue
- s = s.rstrip()
- while s[-1] == '\\':
- s2 = f.readline().strip()
+ with open(abs_fn, 'r') as f:
+
+ statements = ast.StatementGroup()
+ lineno = 0
+ while True:
lineno = lineno + 1
- if (not s2 or s2 and s2[0] != "#") and s[0] == "#" :
- bb.fatal("There is a confusing multiline, partially commented expression on line %s of file %s (%s).\nPlease clarify whether this is all a comment or should be parsed." % (lineno, fn, s))
- s = s[:-1] + s2
- # skip comments
- if s[0] == '#':
- continue
- feeder(lineno, s, abs_fn, statements)
+ s = f.readline()
+ if not s:
+ break
+ w = s.strip()
+ # skip empty lines
+ if not w:
+ continue
+ s = s.rstrip()
+ while s[-1] == '\\':
+ s2 = f.readline().rstrip()
+ lineno = lineno + 1
+ if (not s2 or s2 and s2[0] != "#") and s[0] == "#" :
+ bb.fatal("There is a confusing multiline, partially commented expression on line %s of file %s (%s).\nPlease clarify whether this is all a comment or should be parsed." % (lineno, fn, s))
+ s = s[:-1] + s2
+ # skip comments
+ if s[0] == '#':
+ continue
+ feeder(lineno, s, abs_fn, statements)
# DONE WITH PARSING... time to evaluate
data.setVar('FILE', abs_fn)