Gentoo Archives: gentoo-commits

From: "André Erdmann" <dywi@×××××××.de>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/util/
Date: Tue, 03 Sep 2013 15:51:05
Message-Id: 1378222977.9e02fab9a6d7c5ec92bda147df91ccc58aacdf78.dywi@gentoo
1 commit: 9e02fab9a6d7c5ec92bda147df91ccc58aacdf78
2 Author: André Erdmann <dywi <AT> mailerd <DOT> de>
3 AuthorDate: Tue Sep 3 15:42:57 2013 +0000
4 Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
5 CommitDate: Tue Sep 3 15:42:57 2013 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=9e02fab9
7
8 ebuildparser: optionally yield placeholders
9
10 ... when parsing distfiles.
11
12 ---
13 roverlay/util/ebuildparser.py | 21 +++++++++++++++++++--
14 1 file changed, 19 insertions(+), 2 deletions(-)
15
16 diff --git a/roverlay/util/ebuildparser.py b/roverlay/util/ebuildparser.py
17 index 3f27b65..8c16dd5 100644
18 --- a/roverlay/util/ebuildparser.py
19 +++ b/roverlay/util/ebuildparser.py
20 @@ -217,7 +217,9 @@ class SrcUriParser ( EbuildParser ):
21 yield entry
22 # --- end of _iterate (...) ---
23
24 - def iter_local_files ( self, ignore_unparseable=False ):
25 + def iter_local_files (
26 + self, ignore_unparseable=False, yield_unparseable=False
27 + ):
28 def convert_chars_with_vars ( text ):
29 mode = 0
30 for index, char in enumerate ( text ):
31 @@ -263,7 +265,22 @@ class SrcUriParser ( EbuildParser ):
32 try:
33 yield varstr ( local_file )
34 except ParserException:
35 - pass
36 + if yield_unparseable in { None, True }:
37 + yield None
38 + elif yield_unparseable:
39 + yield local_file
40 +
41 + except ( KeyError, IndexError ) as err:
42 + # FIXME debug print
43 + print (
44 + "FIXME: {} {} occured while parsing {!r}".format (
45 + err.__class__.__name__, str(err), local_file
46 + )
47 + )
48 + if yield_unparseable in { None, True }:
49 + yield None
50 + elif yield_unparseable:
51 + yield local_file
52 else:
53 yield varstr ( local_file )