* [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/pkgdir/
@ 2013-08-29 12:36 99% André Erdmann
0 siblings, 0 replies; 1+ results
From: André Erdmann @ 2013-08-29 12:36 UTC (permalink / raw
To: gentoo-commits
commit: 0004c002c9082ea81b515b806dc0da6cca0a741c
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Thu Aug 29 09:20:53 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Thu Aug 29 09:20:53 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=0004c002
ebuildparser: handle vartable=None
---
roverlay/overlay/pkgdir/ebuildparser.py | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/roverlay/overlay/pkgdir/ebuildparser.py b/roverlay/overlay/pkgdir/ebuildparser.py
index 367a4ec..3f27b65 100644
--- a/roverlay/overlay/pkgdir/ebuildparser.py
+++ b/roverlay/overlay/pkgdir/ebuildparser.py
@@ -48,8 +48,12 @@ class SrcUriEntry ( object ):
class EbuildParser ( object ):
@classmethod
- def from_file ( cls, filepath, vartable=None ):
+ def from_file ( cls, filepath, vartable=None, unquote_value=None ):
instance = cls ( filepath, vartable=vartable )
+
+ if unquote_value is not None:
+ instance.unquote_value = bool ( unquote_value )
+
instance.read()
return instance
# --- end of from_file (...) ---
@@ -58,6 +62,7 @@ class EbuildParser ( object ):
super ( EbuildParser, self ).__init__()
self.filepath = filepath
self.vartable = vartable
+ self.unquote_value = True
# --- end of __init__ (...) ---
def _read_tokens ( self, breakparse=None ):
@@ -77,7 +82,7 @@ class EbuildParser ( object ):
token = reader.get_token()
# --- end of _read_tokens (...) ---
- def _read_variables ( self, do_unquote=True ):
+ def _read_variables ( self ):
# assumption: no (important) variables after the first function
@@ -140,7 +145,7 @@ class EbuildParser ( object ):
# pass
- if do_unquote:
+ if self.unquote_value:
return {
varname: (
roverlay.strutil.unquote ( value ) if isinstance ( value, str )
@@ -243,9 +248,12 @@ class SrcUriParser ( EbuildParser ):
yield char
# --- end of convert_chars_with_vars (...) ---
- varstr = lambda s: VFORMAT (
- ''.join ( convert_chars_with_vars ( s ) ), (), self.vartable
- )
+ if self.vartable is None:
+ varstr = lambda s: ''.join ( convert_chars_with_vars ( s ) )
+ else:
+ varstr = lambda s: VFORMAT (
+ ''.join ( convert_chars_with_vars ( s ) ), (), self.vartable
+ )
if self.src_uri:
for entry in self.src_uri:
^ permalink raw reply related [relevance 99%]
Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2013-08-29 12:36 99% [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/pkgdir/ André Erdmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox